From 10c3445543b61bef40037f4c341269fb70b985c8 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 3 Jul 2023 01:53:00 -0700 Subject: [PATCH] Move aggs to internal/aggregate (#4283) --- sdk/metric/instrument.go | 16 +++---- sdk/metric/instrument_test.go | 18 ++++---- .../internal/{ => aggregate}/aggregator.go | 2 +- .../aggregator_example_test.go | 8 ++-- .../{ => aggregate}/aggregator_test.go | 2 +- sdk/metric/internal/{ => aggregate}/doc.go | 4 +- sdk/metric/internal/{ => aggregate}/filter.go | 2 +- .../internal/{ => aggregate}/filter_test.go | 2 +- .../internal/{ => aggregate}/histogram.go | 2 +- .../{ => aggregate}/histogram_test.go | 2 +- .../internal/{ => aggregate}/lastvalue.go | 2 +- .../{ => aggregate}/lastvalue_test.go | 2 +- sdk/metric/internal/{ => aggregate}/sum.go | 2 +- .../internal/{ => aggregate}/sum_test.go | 2 +- sdk/metric/meter.go | 6 +-- sdk/metric/pipeline.go | 33 +++++++------- sdk/metric/pipeline_registry_test.go | 44 +++++++++---------- 17 files changed, 75 insertions(+), 74 deletions(-) rename sdk/metric/internal/{ => aggregate}/aggregator.go (96%) rename sdk/metric/internal/{ => aggregate}/aggregator_example_test.go (94%) rename sdk/metric/internal/{ => aggregate}/aggregator_test.go (98%) rename sdk/metric/internal/{ => aggregate}/doc.go (81%) rename sdk/metric/internal/{ => aggregate}/filter.go (97%) rename sdk/metric/internal/{ => aggregate}/filter_test.go (98%) rename sdk/metric/internal/{ => aggregate}/histogram.go (98%) rename sdk/metric/internal/{ => aggregate}/histogram_test.go (98%) rename sdk/metric/internal/{ => aggregate}/lastvalue.go (95%) rename sdk/metric/internal/{ => aggregate}/lastvalue_test.go (97%) rename sdk/metric/internal/{ => aggregate}/sum.go (99%) rename sdk/metric/internal/{ => aggregate}/sum_test.go (99%) diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index ffaf0917cb6..e18313c96b1 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" - "go.opentelemetry.io/otel/sdk/metric/internal" + "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -171,7 +171,7 @@ type streamID struct { } type int64Inst struct { - aggregators []internal.Aggregator[int64] + aggregators []aggregate.Aggregator[int64] embedded.Int64Counter embedded.Int64UpDownCounter @@ -192,7 +192,7 @@ func (i *int64Inst) Record(ctx context.Context, val int64, opts ...metric.Record i.aggregate(ctx, val, c.Attributes()) } -func (i *int64Inst) aggregate(ctx context.Context, val int64, s attribute.Set) { +func (i *int64Inst) aggregate(ctx context.Context, val int64, s attribute.Set) { // nolint:revive // okay to shadow pkg with method. if err := ctx.Err(); err != nil { return } @@ -202,7 +202,7 @@ func (i *int64Inst) aggregate(ctx context.Context, val int64, s attribute.Set) { } type float64Inst struct { - aggregators []internal.Aggregator[float64] + aggregators []aggregate.Aggregator[float64] embedded.Float64Counter embedded.Float64UpDownCounter @@ -254,7 +254,7 @@ var _ metric.Float64ObservableCounter = float64Observable{} var _ metric.Float64ObservableUpDownCounter = float64Observable{} var _ metric.Float64ObservableGauge = float64Observable{} -func newFloat64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []internal.Aggregator[float64]) float64Observable { +func newFloat64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []aggregate.Aggregator[float64]) float64Observable { return float64Observable{ observable: newObservable(scope, kind, name, desc, u, agg), } @@ -273,7 +273,7 @@ var _ metric.Int64ObservableCounter = int64Observable{} var _ metric.Int64ObservableUpDownCounter = int64Observable{} var _ metric.Int64ObservableGauge = int64Observable{} -func newInt64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []internal.Aggregator[int64]) int64Observable { +func newInt64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []aggregate.Aggregator[int64]) int64Observable { return int64Observable{ observable: newObservable(scope, kind, name, desc, u, agg), } @@ -283,10 +283,10 @@ type observable[N int64 | float64] struct { metric.Observable observablID[N] - aggregators []internal.Aggregator[N] + aggregators []aggregate.Aggregator[N] } -func newObservable[N int64 | float64](scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []internal.Aggregator[N]) *observable[N] { +func newObservable[N int64 | float64](scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []aggregate.Aggregator[N]) *observable[N] { return &observable[N]{ observablID: observablID[N]{ name: name, diff --git a/sdk/metric/instrument_test.go b/sdk/metric/instrument_test.go index 0a8f5924473..7aed2838348 100644 --- a/sdk/metric/instrument_test.go +++ b/sdk/metric/instrument_test.go @@ -19,7 +19,7 @@ import ( "testing" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/metric/internal" + "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" ) func BenchmarkInstrument(b *testing.B) { @@ -32,10 +32,10 @@ func BenchmarkInstrument(b *testing.B) { } b.Run("instrumentImpl/aggregate", func(b *testing.B) { - inst := int64Inst{aggregators: []internal.Aggregator[int64]{ - internal.NewLastValue[int64](), - internal.NewCumulativeSum[int64](true), - internal.NewDeltaSum[int64](true), + inst := int64Inst{aggregators: []aggregate.Aggregator[int64]{ + aggregate.NewLastValue[int64](), + aggregate.NewCumulativeSum[int64](true), + aggregate.NewDeltaSum[int64](true), }} ctx := context.Background() @@ -47,10 +47,10 @@ func BenchmarkInstrument(b *testing.B) { }) b.Run("observable/observe", func(b *testing.B) { - o := observable[int64]{aggregators: []internal.Aggregator[int64]{ - internal.NewLastValue[int64](), - internal.NewCumulativeSum[int64](true), - internal.NewDeltaSum[int64](true), + o := observable[int64]{aggregators: []aggregate.Aggregator[int64]{ + aggregate.NewLastValue[int64](), + aggregate.NewCumulativeSum[int64](true), + aggregate.NewDeltaSum[int64](true), }} b.ReportAllocs() diff --git a/sdk/metric/internal/aggregator.go b/sdk/metric/internal/aggregate/aggregator.go similarity index 96% rename from sdk/metric/internal/aggregator.go rename to sdk/metric/internal/aggregate/aggregator.go index 42694d87020..1c8c2428a4b 100644 --- a/sdk/metric/internal/aggregator.go +++ b/sdk/metric/internal/aggregate/aggregator.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "time" diff --git a/sdk/metric/internal/aggregator_example_test.go b/sdk/metric/internal/aggregate/aggregator_example_test.go similarity index 94% rename from sdk/metric/internal/aggregator_example_test.go rename to sdk/metric/internal/aggregate/aggregator_example_test.go index fdbb19650ff..2376f5ea10a 100644 --- a/sdk/metric/internal/aggregator_example_test.go +++ b/sdk/metric/internal/aggregate/aggregator_example_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal +package aggregate import ( "context" @@ -105,7 +105,7 @@ func Example() { _, _ = m.Int64Histogram("histogram example") // Output: - // using *internal.cumulativeSum[int64] aggregator for counter - // using *internal.lastValue[int64] aggregator for up-down counter - // using *internal.deltaHistogram[int64] aggregator for histogram + // using *aggregate.cumulativeSum[int64] aggregator for counter + // using *aggregate.lastValue[int64] aggregator for up-down counter + // using *aggregate.deltaHistogram[int64] aggregator for histogram } diff --git a/sdk/metric/internal/aggregator_test.go b/sdk/metric/internal/aggregate/aggregator_test.go similarity index 98% rename from sdk/metric/internal/aggregator_test.go rename to sdk/metric/internal/aggregate/aggregator_test.go index 6f5f32b1dc7..d0569fb1ca7 100644 --- a/sdk/metric/internal/aggregator_test.go +++ b/sdk/metric/internal/aggregate/aggregator_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "strconv" diff --git a/sdk/metric/internal/doc.go b/sdk/metric/internal/aggregate/doc.go similarity index 81% rename from sdk/metric/internal/doc.go rename to sdk/metric/internal/aggregate/doc.go index e1aa11ab2e1..e83a2693faf 100644 --- a/sdk/metric/internal/doc.go +++ b/sdk/metric/internal/aggregate/doc.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package internal provides types and functionality used to aggregate and +// Package aggregate provides aggregate types used compute aggregations and // cycle the state of metric measurements made by the SDK. These types and // functionality are meant only for internal SDK use. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" diff --git a/sdk/metric/internal/filter.go b/sdk/metric/internal/aggregate/filter.go similarity index 97% rename from sdk/metric/internal/filter.go rename to sdk/metric/internal/aggregate/filter.go index 5c60c5e0d0b..241936a6ea7 100644 --- a/sdk/metric/internal/filter.go +++ b/sdk/metric/internal/aggregate/filter.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "go.opentelemetry.io/otel/attribute" diff --git a/sdk/metric/internal/filter_test.go b/sdk/metric/internal/aggregate/filter_test.go similarity index 98% rename from sdk/metric/internal/filter_test.go rename to sdk/metric/internal/aggregate/filter_test.go index e1333c1d4d1..a540c3a453f 100644 --- a/sdk/metric/internal/filter_test.go +++ b/sdk/metric/internal/aggregate/filter_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "fmt" diff --git a/sdk/metric/internal/histogram.go b/sdk/metric/internal/aggregate/histogram.go similarity index 98% rename from sdk/metric/internal/histogram.go rename to sdk/metric/internal/aggregate/histogram.go index 7ad454e96c4..8268c42bc75 100644 --- a/sdk/metric/internal/histogram.go +++ b/sdk/metric/internal/aggregate/histogram.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "sort" diff --git a/sdk/metric/internal/histogram_test.go b/sdk/metric/internal/aggregate/histogram_test.go similarity index 98% rename from sdk/metric/internal/histogram_test.go rename to sdk/metric/internal/aggregate/histogram_test.go index 20bd19a4167..5bf4117d36c 100644 --- a/sdk/metric/internal/histogram_test.go +++ b/sdk/metric/internal/aggregate/histogram_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "sort" diff --git a/sdk/metric/internal/lastvalue.go b/sdk/metric/internal/aggregate/lastvalue.go similarity index 95% rename from sdk/metric/internal/lastvalue.go rename to sdk/metric/internal/aggregate/lastvalue.go index 16ee77362c4..2f2f63a3320 100644 --- a/sdk/metric/internal/lastvalue.go +++ b/sdk/metric/internal/aggregate/lastvalue.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "sync" diff --git a/sdk/metric/internal/lastvalue_test.go b/sdk/metric/internal/aggregate/lastvalue_test.go similarity index 97% rename from sdk/metric/internal/lastvalue_test.go rename to sdk/metric/internal/aggregate/lastvalue_test.go index 6b17198ae98..3d5d92b3a75 100644 --- a/sdk/metric/internal/lastvalue_test.go +++ b/sdk/metric/internal/aggregate/lastvalue_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "testing" diff --git a/sdk/metric/internal/sum.go b/sdk/metric/internal/aggregate/sum.go similarity index 99% rename from sdk/metric/internal/sum.go rename to sdk/metric/internal/aggregate/sum.go index 7783dc66490..50a59697e16 100644 --- a/sdk/metric/internal/sum.go +++ b/sdk/metric/internal/aggregate/sum.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "sync" diff --git a/sdk/metric/internal/sum_test.go b/sdk/metric/internal/aggregate/sum_test.go similarity index 99% rename from sdk/metric/internal/sum_test.go rename to sdk/metric/internal/aggregate/sum_test.go index e40089566ed..3d206df5412 100644 --- a/sdk/metric/internal/sum_test.go +++ b/sdk/metric/internal/aggregate/sum_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "testing" diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 81f0b2f0bd7..50ea34e100d 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -23,7 +23,7 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/internal" + "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" ) var ( @@ -441,7 +441,7 @@ func newInt64InstProvider(s instrumentation.Scope, p pipelines, c *cache[string, return &int64InstProvider{scope: s, pipes: p, resolve: newResolver[int64](p, c)} } -func (p *int64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]internal.Aggregator[int64], error) { +func (p *int64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]aggregate.Aggregator[int64], error) { inst := Instrument{ Name: name, Description: desc, @@ -469,7 +469,7 @@ func newFloat64InstProvider(s instrumentation.Scope, p pipelines, c *cache[strin return &float64InstProvider{scope: s, pipes: p, resolve: newResolver[float64](p, c)} } -func (p *float64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]internal.Aggregator[float64], error) { +func (p *float64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]aggregate.Aggregator[float64], error) { inst := Instrument{ Name: name, Description: desc, diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 52044a5ddd6..b6b15e1cf05 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -28,6 +28,7 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal" + "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/resource" ) @@ -233,16 +234,16 @@ func newInserter[N int64 | float64](p *pipeline, vc *cache[string, streamID]) *i // // If an instrument is determined to use a Drop aggregation, that instrument is // not inserted nor returned. -func (i *inserter[N]) Instrument(inst Instrument) ([]internal.Aggregator[N], error) { +func (i *inserter[N]) Instrument(inst Instrument) ([]aggregate.Aggregator[N], error) { var ( matched bool - aggs []internal.Aggregator[N] + aggs []aggregate.Aggregator[N] ) errs := &multierror{wrapped: errCreatingAggregators} // The cache will return the same Aggregator instance. Use this fact to // compare pointer addresses to deduplicate Aggregators. - seen := make(map[internal.Aggregator[N]]struct{}) + seen := make(map[aggregate.Aggregator[N]]struct{}) for _, v := range i.pipeline.views { stream, match := v(inst) if !match { @@ -288,7 +289,7 @@ func (i *inserter[N]) Instrument(inst Instrument) ([]internal.Aggregator[N], err // aggVal is the cached value in an aggregators cache. type aggVal[N int64 | float64] struct { - Aggregator internal.Aggregator[N] + Aggregator aggregate.Aggregator[N] Err error } @@ -305,7 +306,7 @@ type aggVal[N int64 | float64] struct { // // If the instrument defines an unknown or incompatible aggregation, an error // is returned. -func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind InstrumentKind, stream Stream) (internal.Aggregator[N], error) { +func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind InstrumentKind, stream Stream) (aggregate.Aggregator[N], error) { switch stream.Aggregation.(type) { case nil, aggregation.Default: // Undefined, nil, means to use the default from the reader. @@ -332,7 +333,7 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum return aggVal[N]{nil, nil} } if stream.AttributeFilter != nil { - agg = internal.NewFilter(agg, stream.AttributeFilter) + agg = aggregate.NewFilter(agg, stream.AttributeFilter) } i.pipeline.addSync(scope, instrumentSync{ @@ -388,14 +389,14 @@ func (i *inserter[N]) streamID(kind InstrumentKind, stream Stream) streamID { // 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, kind InstrumentKind, temporality metricdata.Temporality, monotonic bool) (internal.Aggregator[N], error) { +func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind InstrumentKind, temporality metricdata.Temporality, monotonic bool) (aggregate.Aggregator[N], error) { switch a := agg.(type) { case aggregation.Default: return i.aggregator(DefaultAggregationSelector(kind), kind, temporality, monotonic) case aggregation.Drop: return nil, nil case aggregation.LastValue: - return internal.NewLastValue[N](), nil + return aggregate.NewLastValue[N](), nil case aggregation.Sum: switch kind { case InstrumentKindObservableCounter, InstrumentKindObservableUpDownCounter: @@ -404,9 +405,9 @@ func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind InstrumentKin // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/metrics/api.md#asynchronous-counter-creation switch temporality { case metricdata.CumulativeTemporality: - return internal.NewPrecomputedCumulativeSum[N](monotonic), nil + return aggregate.NewPrecomputedCumulativeSum[N](monotonic), nil case metricdata.DeltaTemporality: - return internal.NewPrecomputedDeltaSum[N](monotonic), nil + return aggregate.NewPrecomputedDeltaSum[N](monotonic), nil default: return nil, fmt.Errorf("%w: %s(%d)", errUnknownTemporality, temporality.String(), temporality) } @@ -414,18 +415,18 @@ func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind InstrumentKin switch temporality { case metricdata.CumulativeTemporality: - return internal.NewCumulativeSum[N](monotonic), nil + return aggregate.NewCumulativeSum[N](monotonic), nil case metricdata.DeltaTemporality: - return internal.NewDeltaSum[N](monotonic), nil + return aggregate.NewDeltaSum[N](monotonic), nil default: return nil, fmt.Errorf("%w: %s(%d)", errUnknownTemporality, temporality.String(), temporality) } case aggregation.ExplicitBucketHistogram: switch temporality { case metricdata.CumulativeTemporality: - return internal.NewCumulativeHistogram[N](a), nil + return aggregate.NewCumulativeHistogram[N](a), nil case metricdata.DeltaTemporality: - return internal.NewDeltaHistogram[N](a), nil + return aggregate.NewDeltaHistogram[N](a), nil default: return nil, fmt.Errorf("%w: %s(%d)", errUnknownTemporality, temporality.String(), temporality) } @@ -536,8 +537,8 @@ func newResolver[N int64 | float64](p pipelines, vc *cache[string, streamID]) re // Aggregators returns the Aggregators that must be updated by the instrument // defined by key. -func (r resolver[N]) Aggregators(id Instrument) ([]internal.Aggregator[N], error) { - var aggs []internal.Aggregator[N] +func (r resolver[N]) Aggregators(id Instrument) ([]aggregate.Aggregator[N], error) { + var aggs []aggregate.Aggregator[N] errs := &multierror{} for _, i := range r.inserters { diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index 642e65e6cc0..69675b5d304 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric/aggregation" - "go.opentelemetry.io/otel/sdk/metric/internal" + "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" "go.opentelemetry.io/otel/sdk/resource" ) @@ -76,7 +76,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader Reader views []View inst Instrument - wantKind internal.Aggregator[N] //Aggregators should match len and types + wantKind aggregate.Aggregator[N] //Aggregators should match len and types wantLen int wantErr error }{ @@ -91,7 +91,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, inst: instruments[InstrumentKindUpDownCounter], - wantKind: internal.NewDeltaSum[N](false), + wantKind: aggregate.NewDeltaSum[N](false), wantLen: 1, }, { @@ -99,7 +99,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, inst: instruments[InstrumentKindHistogram], - wantKind: internal.NewDeltaHistogram[N](aggregation.ExplicitBucketHistogram{}), + wantKind: aggregate.NewDeltaHistogram[N](aggregation.ExplicitBucketHistogram{}), wantLen: 1, }, { @@ -107,7 +107,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, inst: instruments[InstrumentKindObservableCounter], - wantKind: internal.NewPrecomputedDeltaSum[N](true), + wantKind: aggregate.NewPrecomputedDeltaSum[N](true), wantLen: 1, }, { @@ -115,7 +115,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, inst: instruments[InstrumentKindObservableUpDownCounter], - wantKind: internal.NewPrecomputedDeltaSum[N](false), + wantKind: aggregate.NewPrecomputedDeltaSum[N](false), wantLen: 1, }, { @@ -123,7 +123,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, inst: instruments[InstrumentKindObservableGauge], - wantKind: internal.NewLastValue[N](), + wantKind: aggregate.NewLastValue[N](), wantLen: 1, }, { @@ -131,7 +131,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, inst: instruments[InstrumentKindCounter], - wantKind: internal.NewDeltaSum[N](true), + wantKind: aggregate.NewDeltaSum[N](true), wantLen: 1, }, { @@ -139,7 +139,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []View{defaultView}, inst: instruments[InstrumentKindUpDownCounter], - wantKind: internal.NewCumulativeSum[N](false), + wantKind: aggregate.NewCumulativeSum[N](false), wantLen: 1, }, { @@ -147,7 +147,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []View{defaultView}, inst: instruments[InstrumentKindHistogram], - wantKind: internal.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), + wantKind: aggregate.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), wantLen: 1, }, { @@ -155,7 +155,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []View{defaultView}, inst: instruments[InstrumentKindObservableCounter], - wantKind: internal.NewPrecomputedCumulativeSum[N](true), + wantKind: aggregate.NewPrecomputedCumulativeSum[N](true), wantLen: 1, }, { @@ -163,7 +163,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []View{defaultView}, inst: instruments[InstrumentKindObservableUpDownCounter], - wantKind: internal.NewPrecomputedCumulativeSum[N](false), + wantKind: aggregate.NewPrecomputedCumulativeSum[N](false), wantLen: 1, }, { @@ -171,7 +171,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []View{defaultView}, inst: instruments[InstrumentKindObservableGauge], - wantKind: internal.NewLastValue[N](), + wantKind: aggregate.NewLastValue[N](), wantLen: 1, }, { @@ -179,7 +179,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []View{defaultView}, inst: instruments[InstrumentKindCounter], - wantKind: internal.NewCumulativeSum[N](true), + wantKind: aggregate.NewCumulativeSum[N](true), wantLen: 1, }, { @@ -187,7 +187,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []View{changeAggView}, inst: instruments[InstrumentKindCounter], - wantKind: internal.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), + wantKind: aggregate.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), wantLen: 1, }, { @@ -195,7 +195,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []View{defaultView, renameView}, inst: instruments[InstrumentKindCounter], - wantKind: internal.NewCumulativeSum[N](true), + wantKind: aggregate.NewCumulativeSum[N](true), wantLen: 2, }, { @@ -203,7 +203,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), views: []View{defaultView}, inst: instruments[InstrumentKindCounter], - wantKind: internal.NewCumulativeSum[N](true), + wantKind: aggregate.NewCumulativeSum[N](true), wantLen: 1, }, { @@ -211,7 +211,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), views: []View{defaultView}, inst: instruments[InstrumentKindUpDownCounter], - wantKind: internal.NewCumulativeSum[N](true), + wantKind: aggregate.NewCumulativeSum[N](true), wantLen: 1, }, { @@ -219,7 +219,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), views: []View{defaultView}, inst: instruments[InstrumentKindHistogram], - wantKind: internal.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), + wantKind: aggregate.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), wantLen: 1, }, { @@ -227,7 +227,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), views: []View{defaultView}, inst: instruments[InstrumentKindObservableCounter], - wantKind: internal.NewPrecomputedCumulativeSum[N](true), + wantKind: aggregate.NewPrecomputedCumulativeSum[N](true), wantLen: 1, }, { @@ -235,7 +235,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), views: []View{defaultView}, inst: instruments[InstrumentKindObservableUpDownCounter], - wantKind: internal.NewPrecomputedCumulativeSum[N](true), + wantKind: aggregate.NewPrecomputedCumulativeSum[N](true), wantLen: 1, }, { @@ -243,7 +243,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), views: []View{defaultView}, inst: instruments[InstrumentKindObservableGauge], - wantKind: internal.NewLastValue[N](), + wantKind: aggregate.NewLastValue[N](), wantLen: 1, }, {