mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
parent
44ea98b24f
commit
806fb8ab7a
@ -96,11 +96,11 @@ func (ots *Opentelemetry) parseSettingsOpentelemetry() error {
|
|||||||
ots.enabled = noopExporter
|
ots.enabled = noopExporter
|
||||||
|
|
||||||
ots.address = section.Key("address").MustString("")
|
ots.address = section.Key("address").MustString("")
|
||||||
|
ots.propagation = section.Key("propagation").MustString("")
|
||||||
if ots.address != "" {
|
if ots.address != "" {
|
||||||
ots.enabled = jaegerExporter
|
ots.enabled = jaegerExporter
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
ots.propagation = section.Key("propagation").MustString("")
|
|
||||||
|
|
||||||
section, err = ots.Cfg.Raw.GetSection("tracing.opentelemetry.otlp")
|
section, err = ots.Cfg.Raw.GetSection("tracing.opentelemetry.otlp")
|
||||||
if err != nil {
|
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) {
|
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{
|
opentelemetrySpan := OpentelemetrySpan{
|
||||||
span: span,
|
span: span,
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ func RequestTracing(tracer tracing.Tracer) web.Middleware {
|
|||||||
rw := web.Rw(w, req)
|
rw := web.Rw(w, req)
|
||||||
|
|
||||||
wireContext := otel.GetTextMapPropagator().Extract(req.Context(), propagation.HeaderCarrier(req.Header))
|
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)
|
req = req.WithContext(ctx)
|
||||||
next.ServeHTTP(w, req)
|
next.ServeHTTP(w, req)
|
||||||
|
Loading…
Reference in New Issue
Block a user