1--- 2title: Tracing 3type: docs 4menu: thanos 5slug: /tracing.md 6--- 7 8# Tracing 9 10Thanos supports different tracing backends that implements `opentracing.Tracer` interface. 11 12All clients are configured using `--tracing.config-file` to reference to the configuration file or `--tracing.config` to put yaml config directly. 13 14## How to use `config` flags? 15 16You can either pass YAML file defined below in `--tracing.config-file` or pass the YAML content directly using `--tracing.config`. 17We recommend the latter as it gives an explicit static view of configuration for each component. It also saves you the fuss of creating and managing additional file. 18 19Don't be afraid of multiline flags! 20 21In Kubernetes it is as easy as (on Thanos sidecar example): 22 23```yaml 24 - args: 25 - sidecar 26 - | 27 --objstore.config=type: GCS 28 config: 29 bucket: <bucket> 30 - --prometheus.url=http://localhost:9090 31 - | 32 --tracing.config=type: STACKDRIVER 33 config: 34 service_name: "" 35 project_id: <project> 36 sample_factor: 16 37 - --tsdb.path=/prometheus-data 38``` 39 40## How to add a new client? 41 421. Create new directory under `pkg/tracing/<provider>` 432. Implement `opentracing.Tracer` interface 443. Add client implementation to the factory in [factory](/pkg/tracing/client/factory.go) code. (Using as small amount of flags as possible in every command) 454. Add client struct config to [cfggen](/scripts/cfggen/main.go) to allow config auto generation. 46 47At that point, anyone can use your provider by spec. 48 49## Configuration 50 51Current tracing supported backends: 52 53### Jaeger 54 55Client for https://github.com/jaegertracing/jaeger tracing. 56 57[embedmd]:# (flags/config_tracing_jaeger.txt yaml) 58```yaml 59type: JAEGER 60config: 61 service_name: "" 62 disabled: false 63 rpc_metrics: false 64 tags: "" 65 sampler_type: "" 66 sampler_param: 0 67 sampler_manager_host_port: "" 68 sampler_max_operations: 0 69 sampler_refresh_interval: 0s 70 reporter_max_queue_size: 0 71 reporter_flush_interval: 0s 72 reporter_log_spans: false 73 endpoint: "" 74 user: "" 75 password: "" 76 agent_host: "" 77 agent_port: 0 78``` 79 80### Stackdriver 81 82Client for https://cloud.google.com/trace/ tracing. 83 84[embedmd]:# (flags/config_tracing_stackdriver.txt yaml) 85```yaml 86type: STACKDRIVER 87config: 88 service_name: "" 89 project_id: "" 90 sample_factor: 0 91``` 92### Elastic APM 93 94Client for https://www.elastic.co/products/apm tracing. 95 96[embedmd]:# (flags/config_tracing_elastic_apm.txt yaml) 97```yaml 98type: ELASTIC_APM 99config: 100 service_name: "" 101 service_version: "" 102 service_environment: "" 103 sample_rate: 0 104``` 105 106### Lightstep 107 108Client for [Ligthstep](https://lightstep.com). 109 110In order to configure Thanos to interact with Lightstep you need to provide at least an [access token](https://docs.lightstep.com/docs/create-and-use-access-tokens) in the configuration file. The `collector` key is optional and used when you have on-premise satellites. 111 112[embedmd]:# (flags/config_tracing_lightstep.txt yaml) 113```yaml 114type: LIGHTSTEP 115config: 116 access_token: "" 117 collector: 118 scheme: "" 119 host: "" 120 port: 0 121 plaintext: false 122 custom_ca_cert_file: "" 123``` 124