Skip to content

Commit

Permalink
test all instrument kinds
Browse files Browse the repository at this point in the history
  • Loading branch information
dmathieu committed Apr 5, 2023
1 parent 262af0d commit 97d6084
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion sdk/metric/pipeline_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,53 @@ func testCreateAggregators[N int64 | float64](t *testing.T) {
wantLen: 2,
},
{
name: "reader with default aggregation should figure out default",
name: "reader with default aggregation should figure out a Counter",
reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })),
views: []View{defaultView},
inst: instruments[InstrumentKindCounter],
wantKind: internal.NewCumulativeSum[N](true),
wantLen: 1,
},
{
name: "reader with default aggregation should figure out an UpDownCounter",
reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })),
views: []View{defaultView},
inst: instruments[InstrumentKindUpDownCounter],
wantKind: internal.NewCumulativeSum[N](true),
wantLen: 1,
},
{
name: "reader with default aggregation should figure out an Histogram",
reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })),
views: []View{defaultView},
inst: instruments[InstrumentKindHistogram],
wantKind: internal.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}),
wantLen: 1,
},
{
name: "reader with default aggregation should figure out an ObservableCounter",
reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })),
views: []View{defaultView},
inst: instruments[InstrumentKindObservableCounter],
wantKind: internal.NewPrecomputedCumulativeSum[N](true),
wantLen: 1,
},
{
name: "reader with default aggregation should figure out an ObservableUpDownCounter",
reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })),
views: []View{defaultView},
inst: instruments[InstrumentKindObservableUpDownCounter],
wantKind: internal.NewPrecomputedCumulativeSum[N](true),
wantLen: 1,
},
{
name: "reader with default aggregation should figure out an ObservableGauge",
reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })),
views: []View{defaultView},
inst: instruments[InstrumentKindObservableGauge],
wantKind: internal.NewLastValue[N](),
wantLen: 1,
},
{
name: "view with invalid aggregation should error",
reader: NewManualReader(),
Expand Down

0 comments on commit 97d6084

Please sign in to comment.