diff --git a/api/tag/map.go b/api/tag/map.go index 4bb537821b4d..7675c9738cb0 100644 --- a/api/tag/map.go +++ b/api/tag/map.go @@ -21,13 +21,15 @@ import ( "github.com/open-telemetry/opentelemetry-go/api/core" ) -type tagMap map[core.Key]tagContent - type tagContent struct { value core.Value meta core.MeasureMetadata } +type tagMap map[core.Key]tagContent + +var _ Map = (*tagMap)(nil) + func (t tagMap) Apply(a1 core.KeyValue, attributes []core.KeyValue, m1 core.Mutator, mutators []core.Mutator) Map { m := make(tagMap, len(t)+len(attributes)+len(mutators)) for k, v := range t { @@ -80,8 +82,6 @@ func (m tagMap) Foreach(f func(kv core.KeyValue) bool) { } } -var _ Map = (*tagMap)(nil) - func (m tagMap) apply(mutator core.Mutator) { if m == nil { return diff --git a/api/tag/tag.go b/api/tag/tag.go index beef47829817..b586c123ff68 100644 --- a/api/tag/tag.go +++ b/api/tag/tag.go @@ -23,6 +23,12 @@ import ( "github.com/open-telemetry/opentelemetry-go/exporter/observer" ) +type ctxTagsType struct{} + +var ( + ctxTagsKey = &ctxTagsType{} +) + type registeredKey struct { name string desc string @@ -30,15 +36,7 @@ type registeredKey struct { eventID core.EventID } -type ctxTagsType struct{} - -type measure struct { - rk *registeredKey -} - -var ( - ctxTagsKey = &ctxTagsType{} -) +var _ core.Key = (*registeredKey)(nil) func register(name string, opts []Option) *registeredKey { rk := ®isteredKey{ @@ -195,6 +193,12 @@ func (k *registeredKey) Value(ctx context.Context) core.KeyValue { } } +type measure struct { + rk *registeredKey +} + +var _ core.Mearsure = (*measure)(nil) + func (m measure) M(v float64) core.Measurement { return core.Measurement{ Measure: m, @@ -206,7 +210,18 @@ func (m measure) V(v float64) core.KeyValue { return m.rk.Float64(v) } -func (m measure) Name() string { return m.rk.Name() } -func (m measure) Description() string { return m.rk.Description() } -func (m measure) Unit() unit.Unit { return m.rk.Unit() } -func (m measure) DefinitionID() core.EventID { return m.rk.DefinitionID() } +func (m measure) Name() string { + return m.rk.Name() +} + +func (m measure) Description() string { + return m.rk.Description() +} + +func (m measure) Unit() unit.Unit { + return m.rk.Unit() +} + +func (m measure) DefinitionID() core.EventID { + return m.rk.DefinitionID() +}