Skip to content

Commit

Permalink
lowering ForceTracingBaggageKey to work with Jaeger
Browse files Browse the repository at this point in the history
Signed-off-by: Denys Zhdanov <denys.zhdanov@adevinta.com>
  • Loading branch information
Denys Zhdanov committed Dec 1, 2021
1 parent d08a12a commit ae643b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/tracing/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"net"
"net/http"
"strconv"
"strings"

"github.com/go-kit/log"
"github.com/go-kit/log/level"
Expand Down Expand Up @@ -35,7 +36,7 @@ func HTTPMiddleware(tracer opentracing.Tracer, name string, logger log.Logger, n
ext.HTTPUrl.Set(span, r.URL.String())

// If client specified ForceTracingBaggageKey header, ensure span includes it to force tracing.
span.SetBaggageItem(ForceTracingBaggageKey, r.Header.Get(ForceTracingBaggageKey))
span.SetBaggageItem(strings.ToLower(ForceTracingBaggageKey), r.Header.Get(ForceTracingBaggageKey))

if t, ok := tracer.(Tracer); ok {
if traceID, ok := t.GetTraceIDFromSpanContext(span.Context()); ok {
Expand Down
3 changes: 2 additions & 1 deletion pkg/tracing/jaeger/jaeger.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"fmt"
"io"
"strings"

"github.com/thanos-io/thanos/pkg/tracing"

Expand Down Expand Up @@ -52,7 +53,7 @@ func NewTracer(ctx context.Context, logger log.Logger, metrics *prometheus.Regis
}

cfg.Headers = &jaeger.HeadersConfig{
JaegerDebugHeader: tracing.ForceTracingBaggageKey,
JaegerDebugHeader: strings.ToLower(tracing.ForceTracingBaggageKey),
}
cfg.Headers.ApplyDefaults()
jaegerTracer, closer, err = cfg.NewTracer(
Expand Down

0 comments on commit ae643b8

Please sign in to comment.