Overview
Distributed tracing provides visibility into:- Request flow across GitLab components (GitLab Rails, Workhorse, Gitaly)
- RPC call latencies and performance bottlenecks
- Service dependencies and interaction patterns
- Error propagation across services
Supported Providers
Gitaly can be compiled with support for various OpenTracing providers through LabKit, including:- Jaeger - Popular open-source tracing system
- Datadog - Commercial APM and tracing platform
- Lightstep - Commercial observability platform
Building with Tracing Support
To enable tracing, you must compile Gitaly with specific build tags. This is done using Go build tags/constraints.Jaeger Example
To build Gitaly with Jaeger tracing support:tracer_static: Enables static tracing supporttracer_static_jaeger: Links the Jaeger tracing implementation
Other Providers
For other providers, replacetracer_static_jaeger with the appropriate build tag:
Runtime Configuration
Once Gitaly is compiled with tracing support, you configure the tracing provider at runtime using theGITLAB_TRACING environment variable.
Configuration Format
TheGITLAB_TRACING environment variable uses a URL-like format:
Jaeger Configuration
To configure Jaeger tracing when starting Gitaly:sampler: Sampling strategy (const,probabilistic,ratelimiting,remote)sampler_param: Sampling parameter (e.g.,1for 100% sampling)udp_endpoint: Jaeger agent endpoint (default:localhost:6831)
Environment Variables
You can also configure tracing using provider-specific environment variables. For Jaeger:Integration with GitLab Components
For complete distributed tracing across your GitLab installation, you should enable tracing in all components:Gitaly
Workhorse
GitLab Rails
Configure ingitlab.yml:
Verifying Tracing
After configuring tracing:- Start your tracing backend (e.g., Jaeger all-in-one container):
- Restart Gitaly with tracing enabled
- Generate some traffic by performing Git operations
-
View traces in the Jaeger UI at
http://localhost:16686
Sampling Strategies
Distributed tracing can generate significant data volume. Use sampling to control overhead:Constant Sampling
Always sample (100%) or never sample (0%):sampler_param=1: Sample all requests (100%)sampler_param=0: Sample no requests (0%)
Probabilistic Sampling
Sample a percentage of requests:sampler_param=0.1: Sample 10% of requests
Rate Limiting
Sample up to N traces per second:sampler_param=10: Sample up to 10 traces per second
Performance Considerations
- Build-time inclusion: Tracing code is only included if you build with the appropriate tags, so there’s no overhead if not compiled in
- Runtime overhead: Even with tracing compiled in, there’s minimal overhead when
GITLAB_TRACINGis not set - Sampling: Use appropriate sampling rates to balance observability with performance
- Network traffic: Traces are sent to the tracing backend over UDP (Jaeger) or HTTP, which adds network overhead
Troubleshooting
No Traces Appearing
-
Verify Gitaly was built with tracing support:
-
Check the
GITLAB_TRACINGenvironment variable is set: -
Verify the tracing backend is running and accessible:
- Check Gitaly logs for tracing initialization errors
Incomplete Traces
If traces are missing spans from certain components:- Ensure all GitLab components (Rails, Workhorse, Gitaly) have tracing enabled
- Verify all components are configured with the same tracing backend
- Check that trace context is being propagated in HTTP/gRPC headers