Tracing: Fix OpenTelemetry Jaeger context propagation (#53269)

* fix otel jaeger context propagation

* add back launch.json

* add back launch.json
This commit is contained in:
zhichli 2022-08-11 07:11:34 -07:00 committed by GitHub
parent 44ea98b24f
commit 806fb8ab7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -96,11 +96,11 @@ func (ots *Opentelemetry) parseSettingsOpentelemetry() error {
ots.enabled = noopExporter
ots.address = section.Key("address").MustString("")
ots.propagation = section.Key("propagation").MustString("")
if ots.address != "" {
ots.enabled = jaegerExporter
return nil
}
ots.propagation = section.Key("propagation").MustString("")
section, err = ots.Cfg.Raw.GetSection("tracing.opentelemetry.otlp")
if err != nil {
@ -234,7 +234,7 @@ func (ots *Opentelemetry) Run(ctx context.Context) error {
}
func (ots *Opentelemetry) Start(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, Span) {
ctx, span := ots.tracer.Start(ctx, spanName)
ctx, span := ots.tracer.Start(ctx, spanName, opts...)
opentelemetrySpan := OpentelemetrySpan{
span: span,
}

View File

@ -72,7 +72,7 @@ func RequestTracing(tracer tracing.Tracer) web.Middleware {
rw := web.Rw(w, req)
wireContext := otel.GetTextMapPropagator().Extract(req.Context(), propagation.HeaderCarrier(req.Header))
ctx, span := tracer.Start(req.Context(), fmt.Sprintf("HTTP %s %s", req.Method, req.URL.Path), trace.WithLinks(trace.LinkFromContext(wireContext)))
ctx, span := tracer.Start(wireContext, fmt.Sprintf("HTTP %s %s", req.Method, req.URL.Path), trace.WithLinks(trace.LinkFromContext(wireContext)))
req = req.WithContext(ctx)
next.ServeHTTP(w, req)