You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-09-16 09:26:25 +02:00
Rename the sdk/export/metric package name (#432)
Rename the package from "export" to "metric". Note that all the existing imports of this package use an explicit name of `export` and, therefore, no import declaration changes are included. Rename the `MetricKind` to `Kind` to not stutter in the type usage. Note this does not include a method name change for the `Descriptor` method `MetricKind`.
This commit is contained in:
@@ -77,7 +77,7 @@ func testRangeNegative(t *testing.T, alt bool, desc *export.Descriptor) {
|
||||
func TestRangeTest(t *testing.T) {
|
||||
for _, nkind := range []core.NumberKind{core.Float64NumberKind, core.Int64NumberKind} {
|
||||
t.Run(nkind.String(), func(t *testing.T) {
|
||||
for _, mkind := range []export.MetricKind{
|
||||
for _, mkind := range []export.Kind{
|
||||
export.CounterKind,
|
||||
export.GaugeKind,
|
||||
export.MeasureKind,
|
||||
|
25
sdk/export/metric/kind_string.go
Normal file
25
sdk/export/metric/kind_string.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// Code generated by "stringer -type=Kind"; DO NOT EDIT.
|
||||
|
||||
package metric
|
||||
|
||||
import "strconv"
|
||||
|
||||
func _() {
|
||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||
// Re-run the stringer command to generate them again.
|
||||
var x [1]struct{}
|
||||
_ = x[CounterKind-0]
|
||||
_ = x[GaugeKind-1]
|
||||
_ = x[MeasureKind-2]
|
||||
}
|
||||
|
||||
const _Kind_name = "CounterKindGaugeKindMeasureKind"
|
||||
|
||||
var _Kind_index = [...]uint8{0, 11, 20, 31}
|
||||
|
||||
func (i Kind) String() string {
|
||||
if i < 0 || i >= Kind(len(_Kind_index)-1) {
|
||||
return "Kind(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
return _Kind_name[_Kind_index[i]:_Kind_index[i+1]]
|
||||
}
|
@@ -12,9 +12,9 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package export
|
||||
package metric
|
||||
|
||||
//go:generate stringer -type=MetricKind
|
||||
//go:generate stringer -type=Kind
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -283,12 +283,12 @@ func (r Record) Labels() Labels {
|
||||
return r.labels
|
||||
}
|
||||
|
||||
// MetricKind describes the kind of instrument.
|
||||
type MetricKind int8
|
||||
// Kind describes the kind of instrument.
|
||||
type Kind int8
|
||||
|
||||
const (
|
||||
// Counter kind indicates a counter instrument.
|
||||
CounterKind MetricKind = iota
|
||||
CounterKind Kind = iota
|
||||
|
||||
// Gauge kind indicates a gauge instrument.
|
||||
GaugeKind
|
||||
@@ -304,7 +304,7 @@ const (
|
||||
// exporter.
|
||||
type Descriptor struct {
|
||||
name string
|
||||
metricKind MetricKind
|
||||
metricKind Kind
|
||||
keys []core.Key
|
||||
description string
|
||||
unit unit.Unit
|
||||
@@ -320,7 +320,7 @@ type Descriptor struct {
|
||||
// exporter.
|
||||
func NewDescriptor(
|
||||
name string,
|
||||
metricKind MetricKind,
|
||||
metricKind Kind,
|
||||
keys []core.Key,
|
||||
description string,
|
||||
unit unit.Unit,
|
||||
@@ -345,7 +345,7 @@ func (d *Descriptor) Name() string {
|
||||
|
||||
// MetricKind returns the kind of instrument: counter, gauge, or
|
||||
// measure.
|
||||
func (d *Descriptor) MetricKind() MetricKind {
|
||||
func (d *Descriptor) MetricKind() Kind {
|
||||
return d.metricKind
|
||||
}
|
||||
|
||||
|
@@ -1,25 +0,0 @@
|
||||
// Code generated by "stringer -type=MetricKind"; DO NOT EDIT.
|
||||
|
||||
package export
|
||||
|
||||
import "strconv"
|
||||
|
||||
func _() {
|
||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||
// Re-run the stringer command to generate them again.
|
||||
var x [1]struct{}
|
||||
_ = x[CounterKind-0]
|
||||
_ = x[GaugeKind-1]
|
||||
_ = x[MeasureKind-2]
|
||||
}
|
||||
|
||||
const _MetricKind_name = "CounterKindGaugeKindMeasureKind"
|
||||
|
||||
var _MetricKind_index = [...]uint8{0, 11, 20, 31}
|
||||
|
||||
func (i MetricKind) String() string {
|
||||
if i < 0 || i >= MetricKind(len(_MetricKind_index)-1) {
|
||||
return "MetricKind(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
return _MetricKind_name[_MetricKind_index[i]:_MetricKind_index[i+1]]
|
||||
}
|
@@ -53,7 +53,7 @@ func newProfiles() []Profile {
|
||||
}
|
||||
}
|
||||
|
||||
func NewAggregatorTest(mkind export.MetricKind, nkind core.NumberKind, alternate bool) *export.Descriptor {
|
||||
func NewAggregatorTest(mkind export.Kind, nkind core.NumberKind, alternate bool) *export.Descriptor {
|
||||
desc := export.NewDescriptor("test.name", mkind, nil, "", "", nkind, alternate)
|
||||
return desc
|
||||
}
|
||||
|
@@ -298,7 +298,7 @@ func (m *SDK) labsFor(ls api.LabelSet) *labels {
|
||||
return &m.empty
|
||||
}
|
||||
|
||||
func (m *SDK) newInstrument(name string, metricKind export.MetricKind, numberKind core.NumberKind, opts *api.Options) *instrument {
|
||||
func (m *SDK) newInstrument(name string, metricKind export.Kind, numberKind core.NumberKind, opts *api.Options) *instrument {
|
||||
descriptor := export.NewDescriptor(
|
||||
name,
|
||||
metricKind,
|
||||
|
Reference in New Issue
Block a user