Correlate OpenTelemetry Data
Overview
Getting a unified view of your application’s performance requires connecting its traces, metrics, logs, user interactions, and more. By correlating your OpenTelemetry data in Datadog, you can navigate between all related telemetry in a single view, allowing you to diagnose and resolve issues faster.
Prerequisite: Unified service tagging
Datadog uses three standard tags to link telemetry together: env
, service
, and version
.
To ensure your OpenTelemetry data is properly correlated, you must configure your application or system to use these tags by setting a standard set of OpenTelemetry resource attributes. Datadog automatically maps these attributes to the correct tags.
OpenTelemetry Resource Attribute | Datadog Tag | Notes |
---|
deployment.environment.name | env | Recommended. Supported in Agent v7.58.0+ and Collector Exporter v0.110.0+. |
deployment.environment | env | Use instead of deployment.environment.name if you are running an Agent version older than v7.58.0 or a Collector Exporter older than v0.110.0. |
service.name | service | |
service.version | version | |
You can set these attributes in your application’s environment variables, SDK, or in the OpenTelemetry Collector.
Set the OTEL_RESOURCE_ATTRIBUTES
environment variable with your service’s information:
export OTEL_SERVICE_NAME="my-service"
export OTEL_RESOURCE_ATTRIBUTES="deployment.environment.name=production,service.version=1.2.3"
Create a Resource with the required attributes and associate it with your TracerProvider in your application code.
Here’s an example using the OpenTelemetry SDK for Python:
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import TracerProvider
resource = Resource(attributes={
"service.name": "<SERVICE>",
"deployment.environment.name": "<ENV>",
"service.version": "<VERSION>"
})
tracer_provider = TracerProvider(resource=resource)
Use the resource
processor in your Collector configuration to set the resource attributes on your telemetry data:
processors:
resource:
attributes:
- key: service.name
value: "my-service"
action: upsert
- key: deployment.environment.name
value: "production"
action: upsert
- key: service.version
value: "1.2.3"
action: upsert
...
Correlate telemetry
After unified service tagging is configured, you can connect your various telemetry streams. Select a guide below for platform-specific instructions.
Further reading
Más enlaces, artículos y documentación útiles: