diff --git a/docs/sources/setup-grafana/configure-grafana/_index.md b/docs/sources/setup-grafana/configure-grafana/_index.md index acd1d0763d06..b861dcc630b8 100644 --- a/docs/sources/setup-grafana/configure-grafana/_index.md +++ b/docs/sources/setup-grafana/configure-grafana/_index.md @@ -2492,6 +2492,26 @@ When set to `false`, the OTLP client will use TLS credentials with the default s
+### `[tracing.opentelemetry.file]` + +Grafana can capture its own distributed traces to a local file in OpenTelemetry Protocol (OTLP) JSON format, without running a collector or a tracing backend. +Capturing stops when the file reaches the size limit or the capture duration elapses, whichever comes first. +Use this exporter for support: turn it on, reproduce an issue, then collect and share the file. + +#### `path` + +The path to the capture file, for example, `/var/lib/grafana/traces/capture.json`. Setting this option turns on the file exporter. The parent directory must already exist and be writable by Grafana. Default value is empty, which turns off the exporter. + +#### `max_file_size_bytes` + +The maximum size of the capture file, in bytes. Default value is `104857600` (100 MiB). The value must be greater than `0`. + +#### `capture_duration` + +How long to capture traces after Grafana starts, expressed as a duration such as `10m`. Default value is `10m`. The value must be greater than `0`. + +
+ ### `[external_image_storage]` These options control how images should be made public so they can be shared on services like Slack or email message. diff --git a/docs/sources/setup-grafana/configure-grafana/configure-tracing/index.md b/docs/sources/setup-grafana/configure-grafana/configure-tracing/index.md index ef36abfc2cda..75cc709ec1a4 100644 --- a/docs/sources/setup-grafana/configure-grafana/configure-tracing/index.md +++ b/docs/sources/setup-grafana/configure-grafana/configure-tracing/index.md @@ -112,3 +112,24 @@ go tool trace ``` For more information about how to analyze trace files, refer to [Go command trace](https://golang.org/cmd/trace/). + +## Export traces to a file + +Grafana can write its own distributed traces to a local file in OpenTelemetry Protocol (OTLP) JSON format, without a collector or a tracing backend. This helps you get traces for debugging without setting up the backend: turn on the exporter, reproduce the issue, then collect and share the file. + +{{< admonition type="note" >}} +Don't use this exporter as a permanent configuration. Use it to troubleshoot issues in Grafana, then turn it off. +{{< /admonition >}} + +This is different from the `-tracing` option in the previous section. That option writes a low-level Go runtime execution trace for `go tool trace`, whereas the file exporter emits the same OpenTelemetry spans that Grafana sends to Jaeger or OTLP endpoints, which describe how requests flow through Grafana. + +To turn it on, set a `path` in the `[tracing.opentelemetry.file]` section. Grafana uses this exporter only when you haven't configured a `tracing.opentelemetry.jaeger` or `tracing.opentelemetry.otlp` endpoint. Grafana limits each capture by file size and duration to protect disk space. + +```ini +[tracing.opentelemetry.file] +path = /var/lib/grafana/traces/capture.json +``` + +For the available options, refer to [`[tracing.opentelemetry.file]`](../#tracingopentelemetryfile) in the configuration reference. + +To view the captured file, open Grafana, go to **Explore**, select a Tempo data source, and select **Import trace**.