diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 22845895e16..f9768fd11cc 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -30,32 +30,32 @@ type InstrumentKind uint8 const ( // instrumentKindUndefined is an undefined instrument kind, it should not // be used by any initialized type. - instrumentKindUndefined InstrumentKind = iota // nolint:deadcode,varcheck,unused + instrumentKindUndefined InstrumentKind = 0 // nolint:deadcode,varcheck,unused // InstrumentKindCounter identifies a group of instruments that record // increasing values synchronously with the code path they are measuring. - InstrumentKindCounter + InstrumentKindCounter InstrumentKind = 1 // InstrumentKindUpDownCounter identifies a group of instruments that // record increasing and decreasing values synchronously with the code path // they are measuring. - InstrumentKindUpDownCounter + InstrumentKindUpDownCounter InstrumentKind = 2 // InstrumentKindHistogram identifies a group of instruments that record a // distribution of values synchronously with the code path they are // measuring. - InstrumentKindHistogram - // InstrumentKindGauge identifies a group of instruments that record - // instantaneous values synchronously with the code path they are - // measuring. - InstrumentKindGauge + InstrumentKindHistogram InstrumentKind = 3 // InstrumentKindObservableCounter identifies a group of instruments that // record increasing values in an asynchronous callback. - InstrumentKindObservableCounter + InstrumentKindObservableCounter InstrumentKind = 4 // InstrumentKindObservableUpDownCounter identifies a group of instruments // that record increasing and decreasing values in an asynchronous // callback. - InstrumentKindObservableUpDownCounter + InstrumentKindObservableUpDownCounter InstrumentKind = 5 // InstrumentKindObservableGauge identifies a group of instruments that // record current values in an asynchronous callback. - InstrumentKindObservableGauge + InstrumentKindObservableGauge InstrumentKind = 6 + // InstrumentKindGauge identifies a group of instruments that record + // instantaneous values synchronously with the code path they are + // measuring. + InstrumentKindGauge InstrumentKind = 7 ) type nonComparable [0]func() // nolint: unused // This is indeed used. diff --git a/sdk/metric/instrumentkind_string.go b/sdk/metric/instrumentkind_string.go index 8fc3d851fdb..25ea6244e57 100644 --- a/sdk/metric/instrumentkind_string.go +++ b/sdk/metric/instrumentkind_string.go @@ -12,15 +12,15 @@ func _() { _ = x[InstrumentKindCounter-1] _ = x[InstrumentKindUpDownCounter-2] _ = x[InstrumentKindHistogram-3] - _ = x[InstrumentKindGauge-4] - _ = x[InstrumentKindObservableCounter-5] - _ = x[InstrumentKindObservableUpDownCounter-6] - _ = x[InstrumentKindObservableGauge-7] + _ = x[InstrumentKindObservableCounter-4] + _ = x[InstrumentKindObservableUpDownCounter-5] + _ = x[InstrumentKindObservableGauge-6] + _ = x[InstrumentKindGauge-7] } -const _InstrumentKind_name = "instrumentKindUndefinedCounterUpDownCounterHistogramGaugeObservableCounterObservableUpDownCounterObservableGauge" +const _InstrumentKind_name = "instrumentKindUndefinedCounterUpDownCounterHistogramObservableCounterObservableUpDownCounterObservableGaugeGauge" -var _InstrumentKind_index = [...]uint8{0, 23, 30, 43, 52, 57, 74, 97, 112} +var _InstrumentKind_index = [...]uint8{0, 23, 30, 43, 52, 69, 92, 107, 112} func (i InstrumentKind) String() string { if i >= InstrumentKind(len(_InstrumentKind_index)-1) { diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index ea0b01daa59..995addaecfc 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -145,14 +145,14 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { ) instruments := []Instrument{ - {Name: "foo", Kind: InstrumentKind(0)}, // Unknown kind - {Name: "foo", Kind: InstrumentKindCounter}, - {Name: "foo", Kind: InstrumentKindUpDownCounter}, - {Name: "foo", Kind: InstrumentKindHistogram}, - {Name: "foo", Kind: InstrumentKindGauge}, - {Name: "foo", Kind: InstrumentKindObservableCounter}, - {Name: "foo", Kind: InstrumentKindObservableUpDownCounter}, - {Name: "foo", Kind: InstrumentKindObservableGauge}, + InstrumentKind(0): {Name: "foo", Kind: InstrumentKind(0)}, // Unknown kind + InstrumentKindCounter: {Name: "foo", Kind: InstrumentKindCounter}, + InstrumentKindUpDownCounter: {Name: "foo", Kind: InstrumentKindUpDownCounter}, + InstrumentKindHistogram: {Name: "foo", Kind: InstrumentKindHistogram}, + InstrumentKindGauge: {Name: "foo", Kind: InstrumentKindGauge}, + InstrumentKindObservableCounter: {Name: "foo", Kind: InstrumentKindObservableCounter}, + InstrumentKindObservableUpDownCounter: {Name: "foo", Kind: InstrumentKindObservableUpDownCounter}, + InstrumentKindObservableGauge: {Name: "foo", Kind: InstrumentKindObservableGauge}, } testcases := []struct {