mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 19:51:50 +00:00
Propagate tracing information (#51847)
Previously, we were not propagating the parent trace ID across HTTP requests. This didn't used to be the case -- I'm honestly not sure when/how this changed, but it's been broken for at least a couple of months. This wraps internal requests with the Opentelemetry transport, which will pass along the tracing information so that we can effectively connect traces across multiple services together.
This commit is contained in:
parent
61b34362e0
commit
6e6f91c42e
1
internal/httpcli/BUILD.bazel
generated
1
internal/httpcli/BUILD.bazel
generated
@ -32,6 +32,7 @@ go_library(
|
||||
"@com_github_prometheus_client_golang//prometheus/promauto",
|
||||
"@com_github_puerkitobio_rehttp//:rehttp",
|
||||
"@com_github_sourcegraph_log//:log",
|
||||
"@io_opentelemetry_go_contrib_instrumentation_net_http_otelhttp//:otelhttp",
|
||||
"@io_opentelemetry_go_otel//attribute",
|
||||
],
|
||||
)
|
||||
|
||||
@ -22,6 +22,7 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
"github.com/sourcegraph/log"
|
||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/env"
|
||||
@ -467,6 +468,7 @@ func TracedTransportOpt(cli *http.Client) error {
|
||||
}
|
||||
|
||||
cli.Transport = &policy.Transport{RoundTripper: cli.Transport}
|
||||
cli.Transport = otelhttp.NewTransport(cli.Transport)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user