Correlate OpenTelemetry Data

Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.

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 AttributeDatadog TagNotes
deployment.environment.nameenvRecommended. Supported in Agent v7.58.0+ and Collector Exporter v0.110.0+.
deployment.environmentenvUse 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.nameservice
service.versionversion

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

Documentation, liens et articles supplémentaires utiles: