HTTP traces are a powerful debugging tool to help you see how your Sourcegraph requests are processed under the hood - like having X-ray vision into how long each part takes and where errors occur.
To enable HTTP traces on your Sourcegraph Instance:
Deploy and / or configure a tracing backend
Configure tracing in your Site Configuration settings, to match your tracing backend
The quickest way to get started with HTTP tracing is to deploy our bundled Jaeger backend. You can also configure an external, OpenTelemetry-compatible backend of your choice.
JaegerTo deploy our bundled Jaeger backend, follow the instructions for your deployment type:
Then configure your Site Configuration:
externalURL
is configuredobservability.tracing
> urlTemplate
observability.client
, for Sourcegraph clients to also report traces, ex. src cli "externalURL": "https://sourcegraph.example.com",
"observability.tracing": {
"urlTemplate": "{{ .ExternalURL }}/-/debug/jaeger/trace/{{ .TraceID }}"
},
"observability.client": {
"openTelemetry": {
"endpoint": "/-/debug/otlp"
}
},
Where:
{{ .ExternalURL }}
is the value of the externalURL
setting in your Sourcegraph instance's Site Configuration{{ .TraceID }}
is the TraceID which gets generated while processing the requestOnce deployed, the Jaeger web UI will be accessible at /-/debug/jaeger
If you prefer to use an external, OTel-compatible platform, you can configure Sourcegraph to export traces to it instead. See our OpenTelemetry documentation for further details.
Then configure your Site Configuration:
observability.tracing
> urlTemplate
observability.client
, for Sourcegraph clients to also report traces, ex. src cliFor example, if you export your traces to Honeycomb, your Site Configuration may look like:
"observability.tracing": {
"urlTemplate": "https://ui.honeycomb.io/YOUR-HONEYCOMB-ORG/environments/YOUR-HONEYCOMB-DATASET/trace?trace_id={{ .TraceID }}"
},
"observability.client": {
"openTelemetry": {
"endpoint": "/-/debug/otlp"
}
},
Where:
{{ .TraceID }}
is the TraceID which gets generated while processing the requestWe generally use the following approach when using traces to help root-cause an issue:
trace=1
parameter in the URLx-trace-url
response headerTraceId
or SpanId
valuesTo trace a search query, run a search on your Sourcegraph instance with the ?trace=1
parameter in the URL.
Depending on your Sourcegraph instance version, a link to the exported trace may appear in the UI:
Trace a GraphQL requestTo trace a GraphQL request, include a X-Sourcegraph-Should-Trace: true
header when you send the request.
The response will include an x-trace-url
header, which will include a URL to the exported trace.
As the OTel (OpenTelemetry) HTTP trace format has gained broad industry adoption, we've centralized our support for HTTP traces on the OTel format, whether with our bundled Jaeger, or an external backend of your choice.
As Jaeger has also switched to the OTel format, we've removed support for Jaeger's deprecated format. We've also removed support for Go's net/trace format.
Basic sampling modesThree basic sampling modes are available in the observability.tracing
Site Configuration:
"observability.tracing": {
"urlTemplate": "{{ .ExternalURL }}/-/debug/jaeger/trace/{{ .TraceID }}",
"sampling": "selective"
}
selective
trace=1
parameter is in the request URLall
none
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4