Skip to content

Commit

Permalink
Rename the sdk/export/metric package name
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
Tyler Yahn authored and MrAlias committed Jan 16, 2020
1 parent 3a32a19 commit 15205d0
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion sdk/export/metric/aggregator/aggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
25 changes: 25 additions & 0 deletions sdk/export/metric/kind_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions sdk/export/metric/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -304,7 +304,7 @@ const (
// exporter.
type Descriptor struct {
name string
metricKind MetricKind
metricKind Kind
keys []core.Key
description string
unit unit.Unit
Expand All @@ -320,7 +320,7 @@ type Descriptor struct {
// exporter.
func NewDescriptor(
name string,
metricKind MetricKind,
metricKind Kind,
keys []core.Key,
description string,
unit unit.Unit,
Expand All @@ -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
}

Expand Down
25 changes: 0 additions & 25 deletions sdk/export/metric/metrickind_string.go

This file was deleted.

2 changes: 1 addition & 1 deletion sdk/metric/aggregator/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/metric/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 15205d0

Please sign in to comment.