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
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:
committed by
rghetia
parent
f863bfbd86
commit
384b4bb86a
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user