1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-02-05 13:15:41 +02:00

rename tag package to distributedContext (#178)

* rename package tag to package distributedContext

* rename Tag -> Entry

* change distributed context -> dctx to avoid capitalization collision

* change dctx -> distributedcontext

* update stackdriver client example
This commit is contained in:
Alyson van Hardenberg 2019-10-10 14:30:22 -07:00 committed by rghetia
parent f863bfbd86
commit 384b4bb86a
21 changed files with 126 additions and 126 deletions

View File

@ -12,21 +12,21 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package tag
package distributedcontext
import (
"context"
"runtime/pprof"
)
type ctxTagsType struct{}
type ctxEntriesType struct{}
var (
ctxTagsKey = &ctxTagsType{}
ctxEntriesKey = &ctxEntriesType{}
)
func WithMap(ctx context.Context, m Map) context.Context {
return context.WithValue(ctx, ctxTagsKey, m)
return context.WithValue(ctx, ctxEntriesKey, m)
}
func NewContext(ctx context.Context, mutators ...Mutator) context.Context {
@ -36,7 +36,7 @@ func NewContext(ctx context.Context, mutators ...Mutator) context.Context {
}
func FromContext(ctx context.Context) Map {
if m, ok := ctx.Value(ctxTagsKey).(Map); ok {
if m, ok := ctx.Value(ctxEntriesKey).(Map); ok {
return m
}
return NewEmptyMap()

View File

@ -12,4 +12,4 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package tag // import "go.opentelemetry.io/api/tag"
package distributedcontext // import "go.opentelemetry.io/api/distributedcontext"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package tag
package distributedcontext
import (
"go.opentelemetry.io/api/core"
@ -22,12 +22,12 @@ type MeasureMetadata struct {
TTL int // -1 == infinite, 0 == do not propagate
}
type tagContent struct {
type entry struct {
value core.Value
meta MeasureMetadata
}
type rawMap map[core.Key]tagContent
type rawMap map[core.Key]entry
type Map struct {
m rawMap
@ -60,12 +60,12 @@ func (m Map) Apply(update MapUpdate) Map {
r[k] = v
}
if update.SingleKV.Key.Defined() {
r[update.SingleKV.Key] = tagContent{
r[update.SingleKV.Key] = entry{
value: update.SingleKV.Value,
}
}
for _, kv := range update.MultiKV {
r[kv.Key] = tagContent{
r[kv.Key] = entry{
value: kv.Value,
}
}
@ -111,7 +111,7 @@ func (m Map) Foreach(f func(kv core.KeyValue) bool) {
func (r rawMap) apply(mutator Mutator) {
key := mutator.KeyValue.Key
content := tagContent{
content := entry{
value: mutator.KeyValue.Value,
meta: mutator.MeasureMetadata,
}

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package tag
package distributedcontext
import (
"go.opentelemetry.io/api/core"

View File

@ -21,7 +21,7 @@ import (
"google.golang.org/grpc/codes"
"go.opentelemetry.io/api/core"
"go.opentelemetry.io/api/tag"
"go.opentelemetry.io/api/distributedcontext"
)
type Tracer interface {
@ -90,8 +90,8 @@ type Span interface {
SetAttributes(...core.KeyValue)
// Modify and delete span attributes
ModifyAttribute(tag.Mutator)
ModifyAttributes(...tag.Mutator)
ModifyAttribute(distributedcontext.Mutator)
ModifyAttributes(...distributedcontext.Mutator)
}
// SpanOption apply changes to SpanOptions.

View File

@ -8,7 +8,7 @@ import (
"google.golang.org/grpc/codes"
"go.opentelemetry.io/api/core"
"go.opentelemetry.io/api/tag"
"go.opentelemetry.io/api/distributedcontext"
"go.opentelemetry.io/api/trace"
)
@ -89,11 +89,11 @@ func (mockSpan) SetAttributes(attributes ...core.KeyValue) {
}
// ModifyAttribute does nothing.
func (mockSpan) ModifyAttribute(mutator tag.Mutator) {
func (mockSpan) ModifyAttribute(mutator distributedcontext.Mutator) {
}
// ModifyAttributes does nothing.
func (mockSpan) ModifyAttributes(mutators ...tag.Mutator) {
func (mockSpan) ModifyAttributes(mutators ...distributedcontext.Mutator) {
}
// End does nothing.

View File

@ -21,7 +21,7 @@ import (
"google.golang.org/grpc/codes"
"go.opentelemetry.io/api/core"
"go.opentelemetry.io/api/tag"
"go.opentelemetry.io/api/distributedcontext"
)
type NoopSpan struct {
@ -56,11 +56,11 @@ func (NoopSpan) SetAttributes(attributes ...core.KeyValue) {
}
// ModifyAttribute does nothing.
func (NoopSpan) ModifyAttribute(mutator tag.Mutator) {
func (NoopSpan) ModifyAttribute(mutator distributedcontext.Mutator) {
}
// ModifyAttributes does nothing.
func (NoopSpan) ModifyAttributes(mutators ...tag.Mutator) {
func (NoopSpan) ModifyAttributes(mutators ...distributedcontext.Mutator) {
}
// End does nothing.

View File

@ -17,9 +17,9 @@ package main
import (
"context"
"go.opentelemetry.io/api/distributedcontext"
"go.opentelemetry.io/api/key"
"go.opentelemetry.io/api/metric"
"go.opentelemetry.io/api/tag"
"go.opentelemetry.io/api/trace"
)
@ -44,9 +44,9 @@ var (
func main() {
ctx := context.Background()
ctx = tag.NewContext(ctx,
tag.Insert(fooKey.String("foo1")),
tag.Insert(barKey.String("bar1")),
ctx = distributedcontext.NewContext(ctx,
distributedcontext.Insert(fooKey.String("foo1")),
distributedcontext.Insert(barKey.String("bar1")),
)
commonLabels := meter.DefineLabels(ctx, lemonsKey.Int(10))
@ -64,9 +64,9 @@ func main() {
gauge.Set(ctx, 1)
meter.RecordBatch(
// Note: call-site variables added as context tags:
tag.NewContext(ctx,
tag.Insert(anotherKey.String("xyz"))),
// Note: call-site variables added as context Entries:
distributedcontext.NewContext(ctx,
distributedcontext.Insert(anotherKey.String("xyz"))),
commonLabels,
oneMetric.Measurement(1.0),

View File

@ -26,8 +26,8 @@ import (
"google.golang.org/grpc/codes"
"go.opentelemetry.io/api/distributedcontext"
"go.opentelemetry.io/api/key"
"go.opentelemetry.io/api/tag"
"go.opentelemetry.io/api/trace"
"go.opentelemetry.io/exporter/trace/stackdriver"
"go.opentelemetry.io/plugin/httptrace"
@ -59,8 +59,8 @@ func main() {
initTracer()
client := http.DefaultClient
ctx := tag.NewContext(context.Background(),
tag.Insert(key.New("username").String("donuts")),
ctx := distributedcontext.NewContext(context.Background(),
distributedcontext.Insert(key.New("username").String("donuts")),
)
var body []byte

View File

@ -20,7 +20,7 @@ import (
"net/http"
"os"
"go.opentelemetry.io/api/tag"
"go.opentelemetry.io/api/distributedcontext"
"go.opentelemetry.io/api/trace"
"go.opentelemetry.io/exporter/trace/stackdriver"
"go.opentelemetry.io/plugin/httptrace"
@ -53,10 +53,10 @@ func main() {
initTracer()
helloHandler := func(w http.ResponseWriter, req *http.Request) {
attrs, tags, spanCtx := httptrace.Extract(req.Context(), req)
attrs, entries, spanCtx := httptrace.Extract(req.Context(), req)
req = req.WithContext(tag.WithMap(req.Context(), tag.NewMap(tag.MapUpdate{
MultiKV: tags,
req = req.WithContext(distributedcontext.WithMap(req.Context(), distributedcontext.NewMap(distributedcontext.MapUpdate{
MultiKV: entries,
})))
ctx, span := trace.GlobalTracer().Start(

View File

@ -25,8 +25,8 @@ import (
"google.golang.org/grpc/codes"
"go.opentelemetry.io/api/distributedcontext"
"go.opentelemetry.io/api/key"
"go.opentelemetry.io/api/tag"
"go.opentelemetry.io/api/trace"
"go.opentelemetry.io/exporter/trace/stdout"
"go.opentelemetry.io/plugin/httptrace"
@ -57,8 +57,8 @@ func main() {
initTracer()
client := http.DefaultClient
ctx := tag.NewContext(context.Background(),
tag.Insert(key.New("username").String("donuts")),
ctx := distributedcontext.NewContext(context.Background(),
distributedcontext.Insert(key.New("username").String("donuts")),
)
var body []byte

View File

@ -19,7 +19,7 @@ import (
"log"
"net/http"
"go.opentelemetry.io/api/tag"
"go.opentelemetry.io/api/distributedcontext"
"go.opentelemetry.io/api/trace"
"go.opentelemetry.io/exporter/trace/stdout"
"go.opentelemetry.io/plugin/httptrace"
@ -49,10 +49,10 @@ func main() {
initTracer()
helloHandler := func(w http.ResponseWriter, req *http.Request) {
attrs, tags, spanCtx := httptrace.Extract(req.Context(), req)
attrs, entries, spanCtx := httptrace.Extract(req.Context(), req)
req = req.WithContext(tag.WithMap(req.Context(), tag.NewMap(tag.MapUpdate{
MultiKV: tags,
req = req.WithContext(distributedcontext.WithMap(req.Context(), distributedcontext.NewMap(distributedcontext.MapUpdate{
MultiKV: entries,
})))
ctx, span := trace.GlobalTracer().Start(

View File

@ -23,8 +23,8 @@ import (
"google.golang.org/grpc/codes"
otelcore "go.opentelemetry.io/api/core"
oteldctx "go.opentelemetry.io/api/distributedcontext"
otelkey "go.opentelemetry.io/api/key"
oteltag "go.opentelemetry.io/api/tag"
oteltrace "go.opentelemetry.io/api/trace"
migration "go.opentelemetry.io/experimental/bridge/opentracing/migration"
@ -44,7 +44,7 @@ type MockContextKeyValue struct {
}
type MockTracer struct {
Resources oteltag.Map
Resources oteldctx.Map
FinishedSpans []*MockSpan
SpareTraceIDs []otelcore.TraceID
SpareSpanIDs []uint64
@ -59,7 +59,7 @@ var _ migration.DeferredContextSetupTracerExtension = &MockTracer{}
func NewMockTracer() *MockTracer {
return &MockTracer{
Resources: oteltag.NewEmptyMap(),
Resources: oteldctx.NewEmptyMap(),
FinishedSpans: nil,
SpareTraceIDs: nil,
SpareSpanIDs: nil,
@ -107,7 +107,7 @@ func (t *MockTracer) Start(ctx context.Context, name string, opts ...oteltrace.S
officialTracer: t,
spanContext: spanContext,
recording: spanOpts.RecordEvent,
Attributes: oteltag.NewMap(upsertMultiMapUpdate(spanOpts.Attributes...)),
Attributes: oteldctx.NewMap(upsertMultiMapUpdate(spanOpts.Attributes...)),
StartTime: startTime,
EndTime: time.Time{},
ParentSpanID: t.getParentSpanID(ctx, &spanOpts),
@ -201,10 +201,10 @@ func (t *MockTracer) DeferredContextSetupHook(ctx context.Context, span oteltrac
}
type MockEvent struct {
CtxAttributes oteltag.Map
CtxAttributes oteldctx.Map
Timestamp time.Time
Msg string
Attributes oteltag.Map
Attributes oteldctx.Map
}
type MockSpan struct {
@ -213,7 +213,7 @@ type MockSpan struct {
spanContext otelcore.SpanContext
recording bool
Attributes oteltag.Map
Attributes oteldctx.Map
StartTime time.Time
EndTime time.Time
ParentSpanID uint64
@ -251,19 +251,19 @@ func (s *MockSpan) SetAttributes(attributes ...otelcore.KeyValue) {
s.applyUpdate(upsertMultiMapUpdate(attributes...))
}
func (s *MockSpan) ModifyAttribute(mutator oteltag.Mutator) {
s.applyUpdate(oteltag.MapUpdate{
func (s *MockSpan) ModifyAttribute(mutator oteldctx.Mutator) {
s.applyUpdate(oteldctx.MapUpdate{
SingleMutator: mutator,
})
}
func (s *MockSpan) ModifyAttributes(mutators ...oteltag.Mutator) {
s.applyUpdate(oteltag.MapUpdate{
func (s *MockSpan) ModifyAttributes(mutators ...oteldctx.Mutator) {
s.applyUpdate(oteldctx.MapUpdate{
MultiMutator: mutators,
})
}
func (s *MockSpan) applyUpdate(update oteltag.MapUpdate) {
func (s *MockSpan) applyUpdate(update oteldctx.MapUpdate) {
s.Attributes = s.Attributes.Apply(update)
}
@ -295,10 +295,10 @@ func (s *MockSpan) AddEvent(ctx context.Context, msg string, attrs ...otelcore.K
func (s *MockSpan) AddEventWithTimestamp(ctx context.Context, timestamp time.Time, msg string, attrs ...otelcore.KeyValue) {
s.Events = append(s.Events, MockEvent{
CtxAttributes: oteltag.FromContext(ctx),
CtxAttributes: oteldctx.FromContext(ctx),
Timestamp: timestamp,
Msg: msg,
Attributes: oteltag.NewMap(upsertMultiMapUpdate(attrs...)),
Attributes: oteldctx.NewMap(upsertMultiMapUpdate(attrs...)),
})
}
@ -314,36 +314,36 @@ func (s *MockSpan) OverrideTracer(tracer oteltrace.Tracer) {
s.officialTracer = tracer
}
func upsertMapUpdate(kv otelcore.KeyValue) oteltag.MapUpdate {
return singleMutatorMapUpdate(oteltag.UPSERT, kv)
func upsertMapUpdate(kv otelcore.KeyValue) oteldctx.MapUpdate {
return singleMutatorMapUpdate(oteldctx.UPSERT, kv)
}
func upsertMultiMapUpdate(kvs ...otelcore.KeyValue) oteltag.MapUpdate {
return multiMutatorMapUpdate(oteltag.UPSERT, kvs...)
func upsertMultiMapUpdate(kvs ...otelcore.KeyValue) oteldctx.MapUpdate {
return multiMutatorMapUpdate(oteldctx.UPSERT, kvs...)
}
func singleMutatorMapUpdate(op oteltag.MutatorOp, kv otelcore.KeyValue) oteltag.MapUpdate {
return oteltag.MapUpdate{
func singleMutatorMapUpdate(op oteldctx.MutatorOp, kv otelcore.KeyValue) oteldctx.MapUpdate {
return oteldctx.MapUpdate{
SingleMutator: keyValueToMutator(op, kv),
}
}
func multiMutatorMapUpdate(op oteltag.MutatorOp, kvs ...otelcore.KeyValue) oteltag.MapUpdate {
return oteltag.MapUpdate{
func multiMutatorMapUpdate(op oteldctx.MutatorOp, kvs ...otelcore.KeyValue) oteldctx.MapUpdate {
return oteldctx.MapUpdate{
MultiMutator: keyValuesToMutators(op, kvs...),
}
}
func keyValuesToMutators(op oteltag.MutatorOp, kvs ...otelcore.KeyValue) []oteltag.Mutator {
var mutators []oteltag.Mutator
func keyValuesToMutators(op oteldctx.MutatorOp, kvs ...otelcore.KeyValue) []oteldctx.Mutator {
var mutators []oteldctx.Mutator
for _, kv := range kvs {
mutators = append(mutators, keyValueToMutator(op, kv))
}
return mutators
}
func keyValueToMutator(op oteltag.MutatorOp, kv otelcore.KeyValue) oteltag.Mutator {
return oteltag.Mutator{
func keyValueToMutator(op oteldctx.MutatorOp, kv otelcore.KeyValue) oteldctx.Mutator {
return oteldctx.Mutator{
MutatorOp: op,
KeyValue: kv,
}

View File

@ -17,9 +17,9 @@ package main
import (
"context"
"go.opentelemetry.io/api/distributedcontext"
"go.opentelemetry.io/api/key"
"go.opentelemetry.io/api/metric"
"go.opentelemetry.io/api/tag"
"go.opentelemetry.io/api/trace"
"go.opentelemetry.io/experimental/streaming/exporter/spanlog"
@ -47,9 +47,9 @@ var (
func main() {
ctx := context.Background()
ctx = tag.NewContext(ctx,
tag.Insert(fooKey.String("foo1")),
tag.Insert(barKey.String("bar1")),
ctx = distributedcontext.NewContext(ctx,
distributedcontext.Insert(fooKey.String("foo1")),
distributedcontext.Insert(barKey.String("bar1")),
)
commonLabels := meter.DefineLabels(ctx, lemonsKey.Int(10))
@ -67,9 +67,9 @@ func main() {
gauge.Set(ctx, 1)
meter.RecordBatch(
// Note: call-site variables added as context tags:
tag.NewContext(ctx,
tag.Insert(anotherKey.String("xyz"))),
// Note: call-site variables added as context entries:
distributedcontext.NewContext(ctx,
distributedcontext.Insert(anotherKey.String("xyz"))),
commonLabels,
oneMetric.Measurement(1.0),

View File

@ -8,8 +8,8 @@ import (
"google.golang.org/grpc/codes"
"go.opentelemetry.io/api/core"
"go.opentelemetry.io/api/distributedcontext"
"go.opentelemetry.io/api/metric"
"go.opentelemetry.io/api/tag"
)
type EventType int
@ -32,12 +32,12 @@ type Event struct {
Context context.Context // core.FromContext() and scope.Active()
// Arguments (type-specific)
Attribute core.KeyValue // SET_ATTRIBUTE
Attributes []core.KeyValue // SET_ATTRIBUTES
Mutator tag.Mutator // SET_ATTRIBUTE
Mutators []tag.Mutator // SET_ATTRIBUTES
Recovered interface{} // END_SPAN
Status codes.Code // SET_STATUS
Attribute core.KeyValue // SET_ATTRIBUTE
Attributes []core.KeyValue // SET_ATTRIBUTES
Mutator distributedcontext.Mutator // SET_ATTRIBUTE
Mutators []distributedcontext.Mutator // SET_ATTRIBUTES
Recovered interface{} // END_SPAN
Status codes.Code // SET_STATUS
// Values
String string // START_SPAN, EVENT, SET_NAME, ...

View File

@ -19,9 +19,9 @@ import (
"strings"
"go.opentelemetry.io/api/core"
"go.opentelemetry.io/api/distributedcontext"
"go.opentelemetry.io/api/key"
"go.opentelemetry.io/api/metric"
"go.opentelemetry.io/api/tag"
"go.opentelemetry.io/experimental/streaming/exporter"
"go.opentelemetry.io/experimental/streaming/exporter/reader"
@ -116,13 +116,13 @@ func AppendEvent(buf *strings.Builder, data reader.Event) {
buf.WriteString(fmt.Sprintf("WAT? %d", data.Type))
}
// Attach the scope (span) attributes and context tags.
// Attach the scope (span) attributes and context entries.
buf.WriteString(" [")
if data.Attributes.Len() > 0 {
data.Attributes.Foreach(f(false))
}
if data.Tags.Len() > 0 {
data.Tags.Foreach(f(true))
if data.Entries.Len() > 0 {
data.Entries.Foreach(f(true))
}
if data.SpanContext.HasSpanID() {
f(false)(sdk.SpanIDKey.String(data.SpanContext.SpanIDString()))
@ -142,7 +142,7 @@ func formatMetricUpdate(buf *strings.Builder, m metric.Measurement) {
buf.WriteString(m.Value.Emit(m.Descriptor.ValueKind()))
}
func formatMetricLabels(buf *strings.Builder, l tag.Map) {
func formatMetricLabels(buf *strings.Builder, l distributedcontext.Map) {
buf.WriteString(" {")
i := 0
l.Foreach(func(kv core.KeyValue) bool {

View File

@ -22,8 +22,8 @@ import (
"google.golang.org/grpc/codes"
"go.opentelemetry.io/api/core"
"go.opentelemetry.io/api/distributedcontext"
"go.opentelemetry.io/api/metric"
"go.opentelemetry.io/api/tag"
"go.opentelemetry.io/api/trace"
"go.opentelemetry.io/experimental/streaming/exporter"
)
@ -37,13 +37,13 @@ type Event struct {
Time time.Time
Sequence exporter.EventID
SpanContext core.SpanContext
Tags tag.Map // context tags
Attributes tag.Map // span attributes, metric labels
Entries distributedcontext.Map // context entries
Attributes distributedcontext.Map // span attributes, metric labels
Measurement metric.Measurement
Measurements []metric.Measurement
Parent core.SpanContext
ParentAttributes tag.Map
ParentAttributes distributedcontext.Map
Duration time.Duration
Name string
@ -59,11 +59,11 @@ type readerObserver struct {
}
type readerSpan struct {
name string
start time.Time
startTags tag.Map
spanContext core.SpanContext
status codes.Code
name string
start time.Time
startEntries distributedcontext.Map
spanContext core.SpanContext
status codes.Code
*readerScope
}
@ -71,7 +71,7 @@ type readerSpan struct {
type readerScope struct {
span *readerSpan
parent exporter.EventID
attributes tag.Map
attributes distributedcontext.Map
}
// NewReaderObserver returns an implementation that computes the
@ -93,23 +93,23 @@ func (ro *readerObserver) orderedObserve(event exporter.Event) {
read := Event{
Time: event.Time,
Sequence: event.Sequence,
Attributes: tag.NewEmptyMap(),
Tags: tag.NewEmptyMap(),
Attributes: distributedcontext.NewEmptyMap(),
Entries: distributedcontext.NewEmptyMap(),
}
if event.Context != nil {
read.Tags = tag.FromContext(event.Context)
read.Entries = distributedcontext.FromContext(event.Context)
}
switch event.Type {
case exporter.START_SPAN:
// Save the span context tags, initial attributes, start time, and name.
// Save the span context entries, initial attributes, start time, and name.
span := &readerSpan{
name: event.String,
start: event.Time,
startTags: tag.FromContext(event.Context),
spanContext: event.Scope.SpanContext,
readerScope: &readerScope{},
name: event.String,
start: event.Time,
startEntries: distributedcontext.FromContext(event.Context),
spanContext: event.Scope.SpanContext,
readerScope: &readerScope{},
}
rattrs, _ := ro.readScope(event.Scope)
@ -150,19 +150,19 @@ func (ro *readerObserver) orderedObserve(event exporter.Event) {
read.Attributes = attrs
read.Duration = event.Time.Sub(span.start)
read.Tags = span.startTags
read.Entries = span.startEntries
read.SpanContext = span.spanContext
// TODO: recovered
case exporter.NEW_SCOPE, exporter.MODIFY_ATTR:
var span *readerSpan
var m tag.Map
var m distributedcontext.Map
sid := event.Scope
if sid.EventID == 0 {
m = tag.NewEmptyMap()
m = distributedcontext.NewEmptyMap()
} else {
parentI, has := ro.scopes.Load(sid.EventID)
if !has {
@ -181,7 +181,7 @@ func (ro *readerObserver) orderedObserve(event exporter.Event) {
span: span,
parent: sid.EventID,
attributes: m.Apply(
tag.MapUpdate{
distributedcontext.MapUpdate{
SingleKV: event.Attribute,
MultiKV: event.Attributes,
SingleMutator: event.Mutator,
@ -201,7 +201,7 @@ func (ro *readerObserver) orderedObserve(event exporter.Event) {
if span != nil {
read.SpanContext = span.spanContext
read.Tags = span.startTags
read.Entries = span.startEntries
}
case exporter.ADD_EVENT:
@ -209,7 +209,7 @@ func (ro *readerObserver) orderedObserve(event exporter.Event) {
read.Message = event.String
attrs, span := ro.readScope(event.Scope)
read.Attributes = attrs.Apply(tag.MapUpdate{
read.Attributes = attrs.Apply(distributedcontext.MapUpdate{
MultiKV: event.Attributes,
})
if span != nil {
@ -270,9 +270,9 @@ func (ro *readerObserver) orderedObserve(event exporter.Event) {
}
}
func (ro *readerObserver) readScope(id exporter.ScopeID) (tag.Map, *readerSpan) {
func (ro *readerObserver) readScope(id exporter.ScopeID) (distributedcontext.Map, *readerSpan) {
if id.EventID == 0 {
return tag.NewEmptyMap(), nil
return distributedcontext.NewEmptyMap(), nil
}
ev, has := ro.scopes.Load(id.EventID)
if !has {
@ -283,7 +283,7 @@ func (ro *readerObserver) readScope(id exporter.ScopeID) (tag.Map, *readerSpan)
} else if sp, ok := ev.(*readerSpan); ok {
return sp.attributes, sp
}
return tag.NewEmptyMap(), nil
return distributedcontext.NewEmptyMap(), nil
}
func (ro *readerObserver) cleanupSpan(id exporter.EventID) {

View File

@ -21,7 +21,7 @@ import (
"google.golang.org/grpc/codes"
"go.opentelemetry.io/api/core"
"go.opentelemetry.io/api/tag"
"go.opentelemetry.io/api/distributedcontext"
"go.opentelemetry.io/api/trace"
"go.opentelemetry.io/experimental/streaming/exporter"
)
@ -71,7 +71,7 @@ func (sp *span) SetAttributes(attributes ...core.KeyValue) {
})
}
func (sp *span) ModifyAttribute(mutator tag.Mutator) {
func (sp *span) ModifyAttribute(mutator distributedcontext.Mutator) {
sp.sdk.exporter.Record(exporter.Event{
Type: exporter.MODIFY_ATTR,
Scope: sp.ScopeID(),
@ -79,7 +79,7 @@ func (sp *span) ModifyAttribute(mutator tag.Mutator) {
})
}
func (sp *span) ModifyAttributes(mutators ...tag.Mutator) {
func (sp *span) ModifyAttributes(mutators ...distributedcontext.Mutator) {
sp.sdk.exporter.Record(exporter.Event{
Type: exporter.MODIFY_ATTR,
Scope: sp.ScopeID(),

View File

@ -21,7 +21,7 @@ import (
"google.golang.org/grpc/codes"
"go.opentelemetry.io/api/core"
"go.opentelemetry.io/api/tag"
"go.opentelemetry.io/api/distributedcontext"
apitrace "go.opentelemetry.io/api/trace"
)
@ -64,11 +64,11 @@ func (ms *MockSpan) SetAttributes(attributes ...core.KeyValue) {
}
// ModifyAttribute does nothing.
func (ms *MockSpan) ModifyAttribute(mutator tag.Mutator) {
func (ms *MockSpan) ModifyAttribute(mutator distributedcontext.Mutator) {
}
// ModifyAttributes does nothing.
func (ms *MockSpan) ModifyAttributes(mutators ...tag.Mutator) {
func (ms *MockSpan) ModifyAttributes(mutators ...distributedcontext.Mutator) {
}
// End does nothing.

View File

@ -34,7 +34,7 @@ var (
propagator = propagation.HttpTraceContextPropagator()
)
// Returns the Attributes, Context Tags, and SpanContext that were encoded by Inject.
// Returns the Attributes, Context Entries, and SpanContext that were encoded by Inject.
func Extract(ctx context.Context, req *http.Request) ([]core.KeyValue, []core.KeyValue, core.SpanContext) {
sc := propagator.Extract(ctx, req.Header)

View File

@ -22,7 +22,7 @@ import (
"google.golang.org/grpc/codes"
"go.opentelemetry.io/api/core"
apitag "go.opentelemetry.io/api/tag"
apidctx "go.opentelemetry.io/api/distributedcontext"
apitrace "go.opentelemetry.io/api/trace"
"go.opentelemetry.io/sdk/export"
"go.opentelemetry.io/sdk/internal"
@ -100,11 +100,11 @@ func (s *span) SetAttributes(attributes ...core.KeyValue) {
}
// ModifyAttribute does nothing.
func (s *span) ModifyAttribute(mutator apitag.Mutator) {
func (s *span) ModifyAttribute(mutator apidctx.Mutator) {
}
// ModifyAttributes does nothing.
func (s *span) ModifyAttributes(mutators ...apitag.Mutator) {
func (s *span) ModifyAttributes(mutators ...apidctx.Mutator) {
}
func (s *span) End(options ...apitrace.EndOption) {