Skip to content

Commit

Permalink
Fixing force tracing with Jaeger (thanos-io#4918)
Browse files Browse the repository at this point in the history
* lowering ForceTracingBaggageKey to work with Jaeger

Signed-off-by: Denys Zhdanov <denys.zhdanov@adevinta.com>

* Adding CHANGELOG entry

Signed-off-by: Denys Zhdanov <denys.zhdanov@adevinta.com>

fixing formatting

Signed-off-by: Denys Zhdanov <denys.zhdanov@adevinta.com>

fixing formatting

Co-authored-by: Denys Zhdanov <denys.zhdanov@adevinta.com>
Signed-off-by: aaron.tam <aaron.tam@oracle.com>
  • Loading branch information
2 people authored and aaron.tam committed Dec 5, 2021
1 parent d08a12a commit 9106926
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -40,6 +40,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#4779](https://github.com/thanos-io/thanos/pull/4779) Examples: Fix the interactive test for MacOS users.
- [#4792](https://github.com/thanos-io/thanos/pull/4792) Store: Fix data race in BucketedBytes pool.
- [#4769](https://github.com/thanos-io/thanos/pull/4769) Query-frontend+api: add "X-Request-ID" field and other fields to start call log.
- [#4918](https://github.com/thanos-io/thanos/pull/4918) Tracing: Fixing force tracing with Jaeger.

### Changed

Expand Down
3 changes: 2 additions & 1 deletion pkg/tracing/http.go
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
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 9106926

Please sign in to comment.