You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-25 22:41:46 +02:00
Reorganize propagation code (shrink PR 381) (#444)
* Rename distributedcontext package to correlation Correlation is the name we agreed upon. * Move trace propagators to api/trace The trace propagators tests had to be moved to a testtrace subpackage to avoid import cycles between api/trace and internal/trace. Needed to shut up golint about stutter in trace.TraceContext - TraceContext is a name of a W3C spec, so this stutter is expected. It's certainly still better than golint's suggestion of having trace.Context. * Rename api/propagators to api/propagation This package will not contain any propagators in the long run, just the interface definitions. Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
This commit is contained in:
committed by
Rahul Patel
parent
437d9af9ab
commit
6b4acf47b8
@@ -25,7 +25,7 @@ import (
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
|
||||
"go.opentelemetry.io/otel/api/distributedcontext"
|
||||
"go.opentelemetry.io/otel/api/correlation"
|
||||
"go.opentelemetry.io/otel/api/global"
|
||||
"go.opentelemetry.io/otel/api/key"
|
||||
"go.opentelemetry.io/otel/api/trace"
|
||||
@@ -56,7 +56,7 @@ func main() {
|
||||
initTracer()
|
||||
|
||||
client := http.DefaultClient
|
||||
ctx := distributedcontext.NewContext(context.Background(),
|
||||
ctx := correlation.NewContext(context.Background(),
|
||||
key.String("username", "donuts"),
|
||||
)
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"go.opentelemetry.io/otel/api/distributedcontext"
|
||||
"go.opentelemetry.io/otel/api/correlation"
|
||||
"go.opentelemetry.io/otel/api/global"
|
||||
"go.opentelemetry.io/otel/api/trace"
|
||||
"go.opentelemetry.io/otel/exporter/trace/stdout"
|
||||
@@ -52,7 +52,7 @@ func main() {
|
||||
helloHandler := func(w http.ResponseWriter, req *http.Request) {
|
||||
attrs, entries, spanCtx := httptrace.Extract(req.Context(), req)
|
||||
|
||||
req = req.WithContext(distributedcontext.WithMap(req.Context(), distributedcontext.NewMap(distributedcontext.MapUpdate{
|
||||
req = req.WithContext(correlation.WithMap(req.Context(), correlation.NewMap(correlation.MapUpdate{
|
||||
MultiKV: entries,
|
||||
})))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user