From 10c7691c4a0da602b6893535321b05e923fb0b22 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 17 Oct 2022 11:47:24 -0700 Subject: [PATCH 1/7] Update Asynchronous API docs Clarify the Counter and UpDownCounter Observe values are the exact counter value, not increments to the previous measurements. --- metric/instrument/asyncfloat64/asyncfloat64.go | 8 +++++--- metric/instrument/asyncint64/asyncint64.go | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/metric/instrument/asyncfloat64/asyncfloat64.go b/metric/instrument/asyncfloat64/asyncfloat64.go index 370715f694c..5c8260ceb6f 100644 --- a/metric/instrument/asyncfloat64/asyncfloat64.go +++ b/metric/instrument/asyncfloat64/asyncfloat64.go @@ -35,7 +35,8 @@ type InstrumentProvider interface { // Counter is an instrument that records increasing values. type Counter interface { - // Observe records the state of the instrument. + // Observe records the state of the instrument to be x. The value of x is + // assumed to be the exact Counter value to record. // // It is only valid to call this within a callback. If called outside of the // registered callback it should have no effect on the instrument, and an @@ -47,7 +48,8 @@ type Counter interface { // UpDownCounter is an instrument that records increasing or decreasing values. type UpDownCounter interface { - // Observe records the state of the instrument. + // Observe records the state of the instrument to be x. The value of x is + // assumed to be the exact UpDownCounter value to record. // // It is only valid to call this within a callback. If called outside of the // registered callback it should have no effect on the instrument, and an @@ -59,7 +61,7 @@ type UpDownCounter interface { // Gauge is an instrument that records independent readings. type Gauge interface { - // Observe records the state of the instrument. + // Observe records the state of the instrument to be x. // // It is only valid to call this within a callback. If called outside of the // registered callback it should have no effect on the instrument, and an diff --git a/metric/instrument/asyncint64/asyncint64.go b/metric/instrument/asyncint64/asyncint64.go index 41a561bc4a2..b07409c7931 100644 --- a/metric/instrument/asyncint64/asyncint64.go +++ b/metric/instrument/asyncint64/asyncint64.go @@ -35,7 +35,8 @@ type InstrumentProvider interface { // Counter is an instrument that records increasing values. type Counter interface { - // Observe records the state of the instrument. + // Observe records the state of the instrument to be x. The value of x is + // assumed to be the exact Counter value to record. // // It is only valid to call this within a callback. If called outside of the // registered callback it should have no effect on the instrument, and an @@ -47,7 +48,8 @@ type Counter interface { // UpDownCounter is an instrument that records increasing or decreasing values. type UpDownCounter interface { - // Observe records the state of the instrument. + // Observe records the state of the instrument to be x. The value of x is + // assumed to be the exact UpDownCounter value to record. // // It is only valid to call this within a callback. If called outside of the // registered callback it should have no effect on the instrument, and an @@ -59,7 +61,7 @@ type UpDownCounter interface { // Gauge is an instrument that records independent readings. type Gauge interface { - // Observe records the state of the instrument. + // Observe records the state of the instrument to be x. // // It is only valid to call this within a callback. If called outside of the // registered callback it should have no effect on the instrument, and an From 6825eb6808ba6602a4b34d469a8fd569ce190fa5 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 17 Oct 2022 12:48:28 -0700 Subject: [PATCH 2/7] Add the pre-computed sum Aggregator --- sdk/metric/internal/sum.go | 52 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/sdk/metric/internal/sum.go b/sdk/metric/internal/sum.go index da8bf34de82..c7bbca47b3e 100644 --- a/sdk/metric/internal/sum.go +++ b/sdk/metric/internal/sum.go @@ -32,6 +32,12 @@ func newValueMap[N int64 | float64]() *valueMap[N] { return &valueMap[N]{values: make(map[attribute.Set]N)} } +func (s *valueMap[N]) set(value N, attr attribute.Set) { + s.Lock() + s.values[attr] = value + s.Unlock() +} + func (s *valueMap[N]) Aggregate(value N, attr attribute.Set) { s.Lock() s.values[attr] += value @@ -49,6 +55,10 @@ func (s *valueMap[N]) Aggregate(value N, attr attribute.Set) { // Each aggregation cycle is treated independently. When the returned // Aggregator's Aggregation method is called it will reset all sums to zero. func NewDeltaSum[N int64 | float64](monotonic bool) Aggregator[N] { + return newDeltaSum[N](monotonic) +} + +func newDeltaSum[N int64 | float64](monotonic bool) *deltaSum[N] { return &deltaSum[N]{ valueMap: newValueMap[N](), monotonic: monotonic, @@ -106,6 +116,10 @@ func (s *deltaSum[N]) Aggregation() metricdata.Aggregation { // Each aggregation cycle is treated independently. When the returned // Aggregator's Aggregation method is called it will reset all sums to zero. func NewCumulativeSum[N int64 | float64](monotonic bool) Aggregator[N] { + return newCumulativeSum[N](monotonic) +} + +func newCumulativeSum[N int64 | float64](monotonic bool) *cumulativeSum[N] { return &cumulativeSum[N]{ valueMap: newValueMap[N](), monotonic: monotonic, @@ -151,3 +165,41 @@ func (s *cumulativeSum[N]) Aggregation() metricdata.Aggregation { } return out } + +// NewPrecomputedSum returns an Aggregator that summarizes a set of +// measurements as their pre-computed arithmetic sum. Each sum is scoped by +// attributes and the aggregation cycle the measurements were made in. +// +// The monotonic value is used to communicate the produced Aggregation is +// monotonic or not. The returned Aggregator does not make any guarantees this +// value is accurate. It is up to the caller to ensure it. +// +// The temporality value is used to communicate the produced Aggregation +// temporality. The returned Aggregator does not make any guarantees this value +// is accurate. It is up to the caller to ensure it. +func NewPrecomputedSum[N int64 | float64](monotonic bool, temporality metricdata.Temporality) Aggregator[N] { + var s settableSum[N] + switch temporality { + case metricdata.DeltaTemporality: + s = newDeltaSum[N](monotonic) + default: + s = newCumulativeSum[N](monotonic) + } + return &precomputedSum[N]{settableSum: s} +} + +type settableSum[N int64 | float64] interface { + set(value N, attr attribute.Set) + Aggregation() metricdata.Aggregation +} + +// precomputedSum summarizes a set of measurements recorded over all +// aggregation cycles directly as an arithmetic sum. +type precomputedSum[N int64 | float64] struct { + settableSum[N] +} + +// Aggregate records value directly as a sum for attr. +func (s *precomputedSum[N]) Aggregate(value N, attr attribute.Set) { + s.set(value, attr) +} From 5c484edfa2137a4054a93d9de4c908d4dae23539 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 17 Oct 2022 12:57:11 -0700 Subject: [PATCH 3/7] Test the PreComputedSum --- sdk/metric/internal/sum_test.go | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/sdk/metric/internal/sum_test.go b/sdk/metric/internal/sum_test.go index 8a838d3f23c..1da83616741 100644 --- a/sdk/metric/internal/sum_test.go +++ b/sdk/metric/internal/sum_test.go @@ -54,6 +54,24 @@ func testSum[N int64 | float64](t *testing.T) { eFunc = cumuExpecter[N](incr, mono) t.Run("NonMonotonic", tester.Run(NewCumulativeSum[N](mono), incr, eFunc)) }) + + t.Run("PreComputed", func(t *testing.T) { + incr, mono, temp := monoIncr, true, metricdata.DeltaTemporality + eFunc := preExpecter[N](incr, mono, temp) + t.Run("Monotonic/Delta", tester.Run(NewPrecomputedSum[N](mono, temp), incr, eFunc)) + + temp = metricdata.CumulativeTemporality + eFunc = preExpecter[N](incr, mono, temp) + t.Run("Monotonic/Cumulative", tester.Run(NewPrecomputedSum[N](mono, temp), incr, eFunc)) + + incr, mono, temp = nonMonoIncr, false, metricdata.DeltaTemporality + eFunc = preExpecter[N](incr, mono, temp) + t.Run("NonMonotonic/Delta", tester.Run(NewPrecomputedSum[N](mono, temp), incr, eFunc)) + + temp = metricdata.CumulativeTemporality + eFunc = preExpecter[N](incr, mono, temp) + t.Run("NonMonotonic/Cumulative", tester.Run(NewPrecomputedSum[N](mono, temp), incr, eFunc)) + }) } func deltaExpecter[N int64 | float64](incr setMap, mono bool) expectFunc { @@ -61,7 +79,7 @@ func deltaExpecter[N int64 | float64](incr setMap, mono bool) expectFunc { return func(m int) metricdata.Aggregation { sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) for a, v := range incr { - sum.DataPoints = append(sum.DataPoints, point[N](a, N(v*m))) + sum.DataPoints = append(sum.DataPoints, point(a, N(v*m))) } return sum } @@ -74,7 +92,18 @@ func cumuExpecter[N int64 | float64](incr setMap, mono bool) expectFunc { cycle++ sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) for a, v := range incr { - sum.DataPoints = append(sum.DataPoints, point[N](a, N(v*cycle*m))) + sum.DataPoints = append(sum.DataPoints, point(a, N(v*cycle*m))) + } + return sum + } +} + +func preExpecter[N int64 | float64](incr setMap, mono bool, temp metricdata.Temporality) expectFunc { + sum := metricdata.Sum[N]{Temporality: temp, IsMonotonic: mono} + return func(int) metricdata.Aggregation { + sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) + for a, v := range incr { + sum.DataPoints = append(sum.DataPoints, point(a, N(v))) } return sum } From a320d5a30539cf7682fdd343adb79836dba818da Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 17 Oct 2022 12:57:28 -0700 Subject: [PATCH 4/7] Use the PrecomputedSum for async counters --- sdk/metric/pipeline.go | 14 +++++++++++--- sdk/metric/pipeline_registry_test.go | 9 +++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 83de81ccc61..0171f4497de 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -266,7 +266,7 @@ func (i *inserter[N]) cachedAggregator(inst view.Instrument, u unit.Unit) (inter // still be applied and a warning should be logged. i.logConflict(id) return i.cache.LookupAggregator(id, func() (internal.Aggregator[N], error) { - agg, err := i.aggregator(inst.Aggregation, id.Temporality, id.Monotonic) + agg, err := i.aggregator(inst.Aggregation, inst.Kind, id.Temporality, id.Monotonic) if err != nil { return nil, err } @@ -322,16 +322,24 @@ func (i *inserter[N]) instrumentID(vi view.Instrument, u unit.Unit) instrumentID return id } -// aggregator returns a new Aggregator matching agg, temporality, and +// aggregator returns a new Aggregator matching agg, kind, temporality, and // monotonic. If the agg is unknown or temporality is invalid, an error is // returned. -func (i *inserter[N]) aggregator(agg aggregation.Aggregation, temporality metricdata.Temporality, monotonic bool) (internal.Aggregator[N], error) { +func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind view.InstrumentKind, temporality metricdata.Temporality, monotonic bool) (internal.Aggregator[N], error) { switch a := agg.(type) { case aggregation.Drop: return nil, nil case aggregation.LastValue: return internal.NewLastValue[N](), nil case aggregation.Sum: + switch kind { + case view.AsyncCounter, view.AsyncUpDownCounter: + // Asynchronous counters and up-down-counters are defined to record + // the absolute value of the count: + // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#asynchronous-counter-creation + return internal.NewPrecomputedSum[N](monotonic, temporality), nil + } + switch temporality { case metricdata.CumulativeTemporality: return internal.NewCumulativeSum[N](monotonic), nil diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index 45bc23ccb18..bc40ce38aa6 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -28,6 +28,7 @@ import ( "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal" + "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/view" "go.opentelemetry.io/otel/sdk/resource" ) @@ -107,7 +108,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.NewPrecomputedSum[N](true, metricdata.DeltaTemporality), wantLen: 1, }, { @@ -115,7 +116,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.NewPrecomputedSum[N](false, metricdata.DeltaTemporality), wantLen: 1, }, { @@ -155,7 +156,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.NewPrecomputedSum[N](true, metricdata.CumulativeTemporality), wantLen: 1, }, { @@ -163,7 +164,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.NewPrecomputedSum[N](false, metricdata.CumulativeTemporality), wantLen: 1, }, { From bbe0452ef5297efc45c7007ed199466823b30c17 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 17 Oct 2022 13:27:42 -0700 Subject: [PATCH 5/7] Add changes to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index baab4d165f4..fa4d8cb660b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Slice attributes of `attribute` package are now comparable based on their value, not instance. (#3108 #3252) - Prometheus exporter will now cumulatively sum histogram buckets. (#3281) - Export the sum of each histogram datapoint uniquely with the `go.opentelemetry.io/otel/exporters/otlpmetric` exporters. (#3284, #3293) +- Recorded values for asynchronous counters (`Counter` and `UpDownCounter`) are interpreted as exact, not incremental, sum values by the metric SDK. (#3350, #3278) ## [1.11.0/0.32.3] 2022-10-12 From 03f6a4c2cb04b0d2b1d2dcc652d846bfc731d55c Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 17 Oct 2022 13:35:32 -0700 Subject: [PATCH 6/7] Ignore false-positive lint error --- sdk/metric/internal/sum.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/metric/internal/sum.go b/sdk/metric/internal/sum.go index c7bbca47b3e..f4e6919c5e1 100644 --- a/sdk/metric/internal/sum.go +++ b/sdk/metric/internal/sum.go @@ -32,7 +32,7 @@ func newValueMap[N int64 | float64]() *valueMap[N] { return &valueMap[N]{values: make(map[attribute.Set]N)} } -func (s *valueMap[N]) set(value N, attr attribute.Set) { +func (s *valueMap[N]) set(value N, attr attribute.Set) { // nolint: unused // This is indeed used. s.Lock() s.values[attr] = value s.Unlock() From 144a05bd5c722a4fa3adf02f460efa782cb8b820 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 19 Oct 2022 10:20:03 -0700 Subject: [PATCH 7/7] Split NewPrecomputedSum into delta/cumulative vers --- sdk/metric/internal/sum.go | 32 +++++++++++++++++----------- sdk/metric/internal/sum_test.go | 20 +++++++++-------- sdk/metric/pipeline.go | 9 +++++++- sdk/metric/pipeline_registry_test.go | 9 ++++---- 4 files changed, 42 insertions(+), 28 deletions(-) diff --git a/sdk/metric/internal/sum.go b/sdk/metric/internal/sum.go index f4e6919c5e1..61b8d20860e 100644 --- a/sdk/metric/internal/sum.go +++ b/sdk/metric/internal/sum.go @@ -166,7 +166,7 @@ func (s *cumulativeSum[N]) Aggregation() metricdata.Aggregation { return out } -// NewPrecomputedSum returns an Aggregator that summarizes a set of +// NewPrecomputedDeltaSum returns an Aggregator that summarizes a set of // measurements as their pre-computed arithmetic sum. Each sum is scoped by // attributes and the aggregation cycle the measurements were made in. // @@ -174,18 +174,24 @@ func (s *cumulativeSum[N]) Aggregation() metricdata.Aggregation { // monotonic or not. The returned Aggregator does not make any guarantees this // value is accurate. It is up to the caller to ensure it. // -// The temporality value is used to communicate the produced Aggregation -// temporality. The returned Aggregator does not make any guarantees this value -// is accurate. It is up to the caller to ensure it. -func NewPrecomputedSum[N int64 | float64](monotonic bool, temporality metricdata.Temporality) Aggregator[N] { - var s settableSum[N] - switch temporality { - case metricdata.DeltaTemporality: - s = newDeltaSum[N](monotonic) - default: - s = newCumulativeSum[N](monotonic) - } - return &precomputedSum[N]{settableSum: s} +// The output Aggregation will report recorded values as delta temporality. It +// is up to the caller to ensure this is accurate. +func NewPrecomputedDeltaSum[N int64 | float64](monotonic bool) Aggregator[N] { + return &precomputedSum[N]{settableSum: newDeltaSum[N](monotonic)} +} + +// NewPrecomputedCumulativeSum returns an Aggregator that summarizes a set of +// measurements as their pre-computed arithmetic sum. Each sum is scoped by +// attributes and the aggregation cycle the measurements were made in. +// +// The monotonic value is used to communicate the produced Aggregation is +// monotonic or not. The returned Aggregator does not make any guarantees this +// value is accurate. It is up to the caller to ensure it. +// +// The output Aggregation will report recorded values as cumulative +// temporality. It is up to the caller to ensure this is accurate. +func NewPrecomputedCumulativeSum[N int64 | float64](monotonic bool) Aggregator[N] { + return &precomputedSum[N]{settableSum: newCumulativeSum[N](monotonic)} } type settableSum[N int64 | float64] interface { diff --git a/sdk/metric/internal/sum_test.go b/sdk/metric/internal/sum_test.go index 1da83616741..eda320070ff 100644 --- a/sdk/metric/internal/sum_test.go +++ b/sdk/metric/internal/sum_test.go @@ -55,22 +55,24 @@ func testSum[N int64 | float64](t *testing.T) { t.Run("NonMonotonic", tester.Run(NewCumulativeSum[N](mono), incr, eFunc)) }) - t.Run("PreComputed", func(t *testing.T) { + t.Run("PreComputedDelta", func(t *testing.T) { incr, mono, temp := monoIncr, true, metricdata.DeltaTemporality eFunc := preExpecter[N](incr, mono, temp) - t.Run("Monotonic/Delta", tester.Run(NewPrecomputedSum[N](mono, temp), incr, eFunc)) + t.Run("Monotonic", tester.Run(NewPrecomputedDeltaSum[N](mono), incr, eFunc)) - temp = metricdata.CumulativeTemporality + incr, mono = nonMonoIncr, false eFunc = preExpecter[N](incr, mono, temp) - t.Run("Monotonic/Cumulative", tester.Run(NewPrecomputedSum[N](mono, temp), incr, eFunc)) + t.Run("NonMonotonic", tester.Run(NewPrecomputedDeltaSum[N](mono), incr, eFunc)) + }) - incr, mono, temp = nonMonoIncr, false, metricdata.DeltaTemporality - eFunc = preExpecter[N](incr, mono, temp) - t.Run("NonMonotonic/Delta", tester.Run(NewPrecomputedSum[N](mono, temp), incr, eFunc)) + t.Run("PreComputedCumulative", func(t *testing.T) { + incr, mono, temp := monoIncr, true, metricdata.CumulativeTemporality + eFunc := preExpecter[N](incr, mono, temp) + t.Run("Monotonic", tester.Run(NewPrecomputedCumulativeSum[N](mono), incr, eFunc)) - temp = metricdata.CumulativeTemporality + incr, mono = nonMonoIncr, false eFunc = preExpecter[N](incr, mono, temp) - t.Run("NonMonotonic/Cumulative", tester.Run(NewPrecomputedSum[N](mono, temp), incr, eFunc)) + t.Run("NonMonotonic", tester.Run(NewPrecomputedCumulativeSum[N](mono), incr, eFunc)) }) } diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 0171f4497de..db70003b1d5 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -337,7 +337,14 @@ func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind view.Instrume // Asynchronous counters and up-down-counters are defined to record // the absolute value of the count: // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#asynchronous-counter-creation - return internal.NewPrecomputedSum[N](monotonic, temporality), nil + switch temporality { + case metricdata.CumulativeTemporality: + return internal.NewPrecomputedCumulativeSum[N](monotonic), nil + case metricdata.DeltaTemporality: + return internal.NewPrecomputedDeltaSum[N](monotonic), nil + default: + return nil, fmt.Errorf("%w: %s(%d)", errUnknownTemporality, temporality.String(), temporality) + } } switch temporality { diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index bc40ce38aa6..eb27da9824e 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -28,7 +28,6 @@ import ( "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal" - "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/view" "go.opentelemetry.io/otel/sdk/resource" ) @@ -108,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.NewPrecomputedSum[N](true, metricdata.DeltaTemporality), + wantKind: internal.NewPrecomputedDeltaSum[N](true), wantLen: 1, }, { @@ -116,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.NewPrecomputedSum[N](false, metricdata.DeltaTemporality), + wantKind: internal.NewPrecomputedDeltaSum[N](false), wantLen: 1, }, { @@ -156,7 +155,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []view.View{{}}, inst: instruments[view.AsyncCounter], - wantKind: internal.NewPrecomputedSum[N](true, metricdata.CumulativeTemporality), + wantKind: internal.NewPrecomputedCumulativeSum[N](true), wantLen: 1, }, { @@ -164,7 +163,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []view.View{{}}, inst: instruments[view.AsyncUpDownCounter], - wantKind: internal.NewPrecomputedSum[N](false, metricdata.CumulativeTemporality), + wantKind: internal.NewPrecomputedCumulativeSum[N](false), wantLen: 1, }, {