Este producto no es compatible con el sitio Datadog seleccionado. ().
Esta página aún no está disponible en español. Estamos trabajando en su traducción.
Si tienes alguna pregunta o comentario sobre nuestro actual proyecto de traducción, no dudes en ponerte en contacto con nosotros.

Overview

Follow this guide to deploy the Datadog Distribution of OpenTelemetry (DDOT) Collector alongside the Datadog Agent on Amazon EKS Fargate. Because EKS Fargate does not support DaemonSets, the Datadog Agent runs as a sidecar container in each application pod.

Need additional OpenTelemetry components? If you need components beyond those included in the default package, follow Use Custom OpenTelemetry Components to extend the Datadog Agent's capabilities. For a list of components included by default, see OpenTelemetry Collector components.

Requirements

To complete this guide, you need the following:

Datadog account:

  1. Create a Datadog account if you don’t have one.
  2. Find or create your Datadog API key.

Software:

Network: When using the Datadog SDK with OpenTelemetry API support, telemetry is routed to different components depending on the signal source. Ensure the following ports are accessible on your Datadog Agent or Collector:

Signal SourceProtocolPortDestination Component
OTel Metrics and Logs APIOTLP (gRPC/HTTP)4317 / 4318Datadog Agent OTLP Receiver or DDOT Collector
Datadog TracingDatadog trace intake8126 (TCP)Datadog Trace Agent
Runtime MetricsDogStatsD8125 (UDP)DogStatsD Server

Install the Datadog Agent with OpenTelemetry Collector

This installation is required for both Datadog SDK + DDOT and OpenTelemetry SDK + DDOT configurations. While the Datadog SDK implements the OpenTelemetry API, it still requires the DDOT Collector to process and forward OTLP metrics and logs.

Set up Datadog API key

Store the Datadog API key as a Kubernetes secret:

kubectl create secret generic datadog-secret \
  --from-literal api-key=<DD_API_KEY>

Replace <DD_API_KEY> with your actual Datadog API key.

Add the Datadog Agent sidecar to your pod spec

Add the Datadog Agent as a sidecar container in your application’s pod spec. The agent and application containers share the same pod network namespace, so the application sends OTLP data to localhost.

The Datadog Agent image must be public.ecr.aws/datadog/agent:latest-full. The latest-full image includes the DDOT Collector. The standard latest image does not.

deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: <SERVICE>
spec:
  selector:
    matchLabels:
      app: <SERVICE>
  template:
    metadata:
      labels:
        app: <SERVICE>
    spec:
      containers:
        - name: <SERVICE>
          image: <APP_IMAGE>
          env:
            - name: OTEL_EXPORTER_OTLP_ENDPOINT
              value: "http://localhost:4317"
            - name: OTEL_EXPORTER_OTLP_PROTOCOL
              value: "grpc"
            - name: OTEL_SERVICE_NAME
              value: "<SERVICE>"
            - name: OTEL_RESOURCE_ATTRIBUTES
              value: "service.version=<VERSION>,deployment.environment.name=<ENV>"
        - name: datadog-agent
          image: public.ecr.aws/datadog/agent:latest-full
          env:
            - name: DD_API_KEY
              valueFrom:
                secretKeyRef:
                  name: datadog-secret
                  key: api-key
            - name: DD_SITE
              value: "<DATADOG_SITE>"
            - name: DD_OTELCOLLECTOR_ENABLED
              value: "true"
            - name: DD_EKS_FARGATE
              value: "true"
            - name: DD_LOGS_ENABLED
              value: "true"
            - name: DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL
              value: "true"

Replace the following placeholders:

  • <SERVICE>: The name of your service.
  • <APP_IMAGE>: Your application container image.
  • <VERSION>: The version of your service.
  • <ENV>: Your deployment environment (for example, production).
  • <DATADOG_SITE>: Your Datadog site. Your site is . (Ensure the correct DATADOG SITE is selected on the right.)

Configure EKS resource detection

The DDOT Collector’s infraattributes processor enriches your telemetry with EKS infrastructure tags when Kubernetes resource attributes are present. Add the EKS resource detector to your OpenTelemetry SDK, or configure the resourcedetection processor in your collector configuration.

Using the OpenTelemetry SDK (recommended): Add the AWS EKS resource detector to your application. This provides attributes such as cloud.provider, cloud.platform, k8s.cluster.name, and Fargate-specific metadata.

Using the collector’s resourcedetection processor: If you control the collector configuration, add the eks and env detectors:

otel-config.yaml

processors:
  resourcedetection:
    detectors: [env, eks]
    timeout: 2s
    override: false

Add resourcedetection to your pipeline processors alongside infraattributes:

otel-config.yaml

service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [resourcedetection, infraattributes]
      exporters: [datadog, datadog/connector]
    metrics:
      receivers: [otlp, datadog/connector]
      processors: [resourcedetection, infraattributes]
      exporters: [datadog]
    logs:
      receivers: [otlp]
      processors: [resourcedetection, infraattributes]
      exporters: [datadog]

Send your telemetry to Datadog

To send your telemetry data to Datadog:

  1. Instrument your application
  2. Correlate observability data
  3. Run your application

Instrument the application

Instrument your application using the OpenTelemetry API.

As an example, you can use the Calendar sample application that’s already instrumented for you. The following code instruments the CalendarService.getDate() method using the OpenTelemetry annotations and API:

CalendarService.java

@WithSpan(kind = SpanKind.CLIENT)
public String getDate() {
    Span span = Span.current();
    span.setAttribute("peer.service", "random-date-service");
    ...
}

Correlate observability data

Unified service tagging ties observability data together in Datadog so you can navigate across metrics, traces, and logs with consistent tags.

In containerized environments, set env, service, and version using OpenTelemetry Resource Attributes environment variables. The DDOT Collector detects this tagging configuration and applies it to the data it collects from containers.

The OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRIBUTES environment variables in the deployment manifest above configure unified service tagging.

Run the application

Apply the updated deployment manifest:

kubectl apply -f deployment.yaml

After the updated pods are running, unified service tagging is fully enabled for your metrics, traces, and logs.

Validate the deployment

  1. Verify that all containers in the pod are running:

    kubectl get pods -l app=<SERVICE>
    

Use Datadog to explore the observability data for your application.

Logs

View logs to monitor and troubleshoot application and system operations.

View logs from the Log Explorer.

Traces

View traces and spans to observe the status and performance of requests processed by your application, with infrastructure metrics correlated in the same trace.

View traces from the Trace Explorer.

Runtime metrics

Monitor your runtime (JVM) metrics for your applications.

View JVM metrics from the JVM Metrics dashboard

Collector health metrics

View metrics from the DDOT Collector to monitor the Collector health.

View Collector health metrics from the OTel dashboard.

Further reading

Más enlaces, artículos y documentación útiles: