1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-07-15 01:04:25 +02:00

Fix Asynchronous Counters Recording (#3350)

* Update Asynchronous API docs

Clarify the Counter and UpDownCounter Observe values are the exact
counter value, not increments to the previous measurements.

* Add the pre-computed sum Aggregator

* Test the PreComputedSum

* Use the PrecomputedSum for async counters

* Add changes to changelog

* Ignore false-positive lint error

* Split NewPrecomputedSum into delta/cumulative vers
This commit is contained in:
Tyler Yahn
2022-10-19 10:35:13 -07:00
committed by GitHub
parent 2d02a2f126
commit 715631d35f
7 changed files with 124 additions and 15 deletions

View File

@ -107,7 +107,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) {
reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)),
views: []view.View{defaultAggView},
inst: instruments[view.AsyncCounter],
wantKind: internal.NewDeltaSum[N](true),
wantKind: internal.NewPrecomputedDeltaSum[N](true),
wantLen: 1,
},
{
@ -115,7 +115,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) {
reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)),
views: []view.View{defaultAggView},
inst: instruments[view.AsyncUpDownCounter],
wantKind: internal.NewDeltaSum[N](false),
wantKind: internal.NewPrecomputedDeltaSum[N](false),
wantLen: 1,
},
{
@ -155,7 +155,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) {
reader: NewManualReader(),
views: []view.View{{}},
inst: instruments[view.AsyncCounter],
wantKind: internal.NewCumulativeSum[N](true),
wantKind: internal.NewPrecomputedCumulativeSum[N](true),
wantLen: 1,
},
{
@ -163,7 +163,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) {
reader: NewManualReader(),
views: []view.View{{}},
inst: instruments[view.AsyncUpDownCounter],
wantKind: internal.NewCumulativeSum[N](false),
wantKind: internal.NewPrecomputedCumulativeSum[N](false),
wantLen: 1,
},
{