diff --git a/conf/defaults.ini b/conf/defaults.ini index 978b650bdc3..97ad0aead32 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -1875,6 +1875,9 @@ rendering_dumpio = # This can be useful to enable (true) when optimizing the rendering mode settings to improve the plugin performance or when troubleshooting. rendering_timing_metrics = +# This is a configuration for OTLP exporter with HTTP protocol, set this URL to enable tracing (ex: http://localhost:4318/v1/traces). Default to empty (tracing disabled). +rendering_tracing_url = + # Additional arguments to pass to the headless browser instance. Default is --no-sandbox. The list of Chromium flags can be found # here (https://peter.sh/experiments/chromium-command-line-switches/). Multiple arguments is separated with comma-character. rendering_args = diff --git a/conf/sample.ini b/conf/sample.ini index f695824f04f..d70f031d6ab 100644 --- a/conf/sample.ini +++ b/conf/sample.ini @@ -1809,6 +1809,9 @@ timeout = 30s # This can be useful to enable (true) when optimizing the rendering mode settings to improve the plugin performance or when troubleshooting. ;rendering_timing_metrics = +# This is a configuration for OTLP exporter with HTTP protocol, set this URL to enable tracing (ex: http://localhost:4318/v1/traces). Default to empty (tracing disabled). +;rendering_tracing_url = + # Additional arguments to pass to the headless browser instance. Default is --no-sandbox. The list of Chromium flags can be found # here (https://peter.sh/experiments/chromium-command-line-switches/). Multiple arguments is separated with comma-character. ;rendering_args = diff --git a/docs/sources/setup-grafana/image-rendering/_index.md b/docs/sources/setup-grafana/image-rendering/_index.md index 6bc566bb3d9..a445d0d2072 100644 --- a/docs/sources/setup-grafana/image-rendering/_index.md +++ b/docs/sources/setup-grafana/image-rendering/_index.md @@ -580,3 +580,21 @@ RENDERING_VIEWPORT_PAGE_ZOOM_LEVEL=1 } } ``` + +#### Tracing + +Enable OpenTelemetry Tracing by setting the tracing URL. Default is empty (disabled). + +```bash +RENDERING_TRACING_URL="http://localhost:4318/v1/traces" +``` + +```json +{ + "rendering": { + "tracing": { + "url": "http://localhost:4318/v1/traces" + } + } +} +``` diff --git a/go.mod b/go.mod index 508369403e8..def22748eba 100644 --- a/go.mod +++ b/go.mod @@ -519,7 +519,7 @@ require ( go.opencensus.io v0.24.0 // @grafana/grafana-backend-group go.opentelemetry.io/auto/sdk v1.1.0 // indirect go.opentelemetry.io/contrib/detectors/gcp v1.33.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 // @grafana/sharing-squad go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 // indirect go.opentelemetry.io/otel/metric v1.34.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.32.0 // indirect diff --git a/pkg/services/rendering/http_mode.go b/pkg/services/rendering/http_mode.go index f278acca7d8..0f877867465 100644 --- a/pkg/services/rendering/http_mode.go +++ b/pkg/services/rendering/http_mode.go @@ -14,6 +14,8 @@ import ( "os" "strconv" "time" + + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" ) var netTransport = &http.Transport{ @@ -25,7 +27,7 @@ var netTransport = &http.Transport{ } var netClient = &http.Client{ - Transport: netTransport, + Transport: otelhttp.NewTransport(netTransport), } const authTokenHeader = "X-Auth-Token" //#nosec G101 -- This is a false positive