You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-23 22:34:47 +02:00
add interface implement check (#35)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user