straight-lizard-48774
03/17/2025, 11:36 AMbrief-egg-61061
03/17/2025, 11:36 AMbrief-egg-61061
03/17/2025, 11:36 AMTRACING_SERVICE_NAME="kratos" TRACING_PROVIDER="otel" TRACING_PROVIDERS_OTLP_INSECURE=true TRACING_PROVIDERS_OTLP_SAMPLING_SAMPLING_RATIO=0.4 TRACING_PROVIDERS_OTLP_SERVER_URL="your.signoz.collector:4318" OTEL_RESOURCE_ATTRIBUTES="service.name=kratos,deployment.environment=your-env,service.version=your-version"
This is similar to the configuration shown in a GitHub issue for Hydra, but would apply to Kratos as well [GitHub Issue: Opentelemetry spans names have changed when changed tracing_provider](https://github.com/ory/hydra/issues/3622). Note that there is a known issue with Kratos where the persistence.sql.NextMessages
job registers as an error in OpenTelemetry tracing, as mentioned in [GitHub Issue: persistence.sql.NextMessages
registers as Error in otel-tracing](https://github.com/ory/kratos/issues/4013). For a local setup to test tracing, you can use the provided docker-compose file in the Kratos repository: docker-compose -f quickstart.yml \ -f quickstart-tracing.yml \ up --build
[Kratos Guides: Distributed tracing](https://www.ory.sh/docs/kratos/guides/tracing)straight-lizard-48774
03/17/2025, 11:38 AMbrief-egg-61061
03/17/2025, 11:38 AMbrief-egg-61061
03/17/2025, 11:38 AMyaml tracing: service_name: "kratos" provider: "otel" providers: otlp: insecure: true sampling: sampling_ratio: 0.4 server_url: "your.signoz.collector:4318"
You can add this to your Kratos configuration file. The OTEL_RESOURCE_ATTRIBUTES
environment variable doesn't have a direct equivalent in the YAML configuration, so you might still need to set that separately as an environment variable. Remember that you can load this configuration file using the -c
or --config
flag when starting Kratos: kratos --config path/to/config.yaml
The configuration file can be in JSON, YAML, or TOML format as mentioned in the [Kratos Configuration documentation](https://www.ory.sh/docs/kratos/configuring). If you need to make changes to the configuration without restarting the server, some configuration values support reloading on the fly, though the documentation doesn't specifically mention if tracing configuration is among those.