@@ -199,11 +199,52 @@ func testCreateAggregators[N int64 | float64](t *testing.T) {
199199 wantLen : 2 ,
200200 },
201201 {
202- name : "reader with invalid aggregation should error" ,
203- reader : NewManualReader (WithAggregationSelector (func (ik InstrumentKind ) aggregation.Aggregation { return aggregation.Default {} })),
204- views : []View {defaultView },
205- inst : instruments [InstrumentKindCounter ],
206- wantErr : errCreatingAggregators ,
202+ name : "reader with default aggregation should figure out a Counter" ,
203+ reader : NewManualReader (WithAggregationSelector (func (ik InstrumentKind ) aggregation.Aggregation { return aggregation.Default {} })),
204+ views : []View {defaultView },
205+ inst : instruments [InstrumentKindCounter ],
206+ wantKind : internal.NewCumulativeSum [N ](true ),
207+ wantLen : 1 ,
208+ },
209+ {
210+ name : "reader with default aggregation should figure out an UpDownCounter" ,
211+ reader : NewManualReader (WithAggregationSelector (func (ik InstrumentKind ) aggregation.Aggregation { return aggregation.Default {} })),
212+ views : []View {defaultView },
213+ inst : instruments [InstrumentKindUpDownCounter ],
214+ wantKind : internal.NewCumulativeSum [N ](true ),
215+ wantLen : 1 ,
216+ },
217+ {
218+ name : "reader with default aggregation should figure out an Histogram" ,
219+ reader : NewManualReader (WithAggregationSelector (func (ik InstrumentKind ) aggregation.Aggregation { return aggregation.Default {} })),
220+ views : []View {defaultView },
221+ inst : instruments [InstrumentKindHistogram ],
222+ wantKind : internal.NewCumulativeHistogram [N ](aggregation.ExplicitBucketHistogram {}),
223+ wantLen : 1 ,
224+ },
225+ {
226+ name : "reader with default aggregation should figure out an ObservableCounter" ,
227+ reader : NewManualReader (WithAggregationSelector (func (ik InstrumentKind ) aggregation.Aggregation { return aggregation.Default {} })),
228+ views : []View {defaultView },
229+ inst : instruments [InstrumentKindObservableCounter ],
230+ wantKind : internal.NewPrecomputedCumulativeSum [N ](true ),
231+ wantLen : 1 ,
232+ },
233+ {
234+ name : "reader with default aggregation should figure out an ObservableUpDownCounter" ,
235+ reader : NewManualReader (WithAggregationSelector (func (ik InstrumentKind ) aggregation.Aggregation { return aggregation.Default {} })),
236+ views : []View {defaultView },
237+ inst : instruments [InstrumentKindObservableUpDownCounter ],
238+ wantKind : internal.NewPrecomputedCumulativeSum [N ](true ),
239+ wantLen : 1 ,
240+ },
241+ {
242+ name : "reader with default aggregation should figure out an ObservableGauge" ,
243+ reader : NewManualReader (WithAggregationSelector (func (ik InstrumentKind ) aggregation.Aggregation { return aggregation.Default {} })),
244+ views : []View {defaultView },
245+ inst : instruments [InstrumentKindObservableGauge ],
246+ wantKind : internal .NewLastValue [N ](),
247+ wantLen : 1 ,
207248 },
208249 {
209250 name : "view with invalid aggregation should error" ,
@@ -594,12 +635,6 @@ func TestIsAggregatorCompatible(t *testing.T) {
594635 agg : aggregation.ExplicitBucketHistogram {},
595636 want : errIncompatibleAggregation ,
596637 },
597- {
598- name : "Default aggregation should error" ,
599- kind : InstrumentKindCounter ,
600- agg : aggregation.Default {},
601- want : errUnknownAggregation ,
602- },
603638 {
604639 name : "unknown kind with Sum should error" ,
605640 kind : undefinedInstrument ,
0 commit comments