OTLP Intake for Serverless
Overview
Send traces from serverless workloads directly to Datadog over HTTP/protobuf, without requiring a Datadog Agent or OpenTelemetry Collector. If your platform appears in the Managed platforms table, use its dedicated endpoint instead.
Serverless workloads can also send logs and metrics through the general OTLP logs and OTLP metrics intake endpoints. The resource attributes on this page apply to all signals your application exports.
Supported platforms:
- AWS: Lambda, ECS Fargate
- Azure: Container Apps, Web Apps (App Service), Azure Functions
- GCP: Cloud Run, Cloud Run Functions, GKE Autopilot
Use direct ingest when running a Collector is impractical (for example, Lambda). If you can run a Collector, see
OpenTelemetry Collector for metadata enrichment, normalization, and centralized sampling.
Prerequisites
The following configuration applies to all platforms.
Protocol: http/protobuf or http/json. grpc is not supported.
Required headers:
dd-api-key: Your Datadog API key.dd-otlp-source: Set to serverless.compute_stats: Set to true. Required for trace metrics.
Service name: Set OTEL_SERVICE_NAME to identify your service. Without it, traces appear as unknown_service.
Resource attributes: Set platform-specific attributes with OTEL_RESOURCE_ATTRIBUTES. See each cloud provider tab below for required and optional attributes.
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=""
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="dd-api-key=${DD_API_KEY},dd-otlp-source=serverless,compute_stats=true"
export OTEL_SERVICE_NAME="my-service"
Setup
Based on your
Datadog site, which is
: Replace
${YOUR_ENDPOINT} with
in the following examples.
Select your cloud provider for platform-specific resource attribute configuration:
Lambda
The AWS Distro for OpenTelemetry (ADOT) Lambda layer provides automatic instrumentation and resource detection for Lambda functions.
Add the ADOT layer to your Lambda function and configure the following environment variables:
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="${YOUR_ENDPOINT}"
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="dd-api-key=${DD_API_KEY},dd-otlp-source=serverless,compute_stats=true"
export OTEL_SERVICE_NAME="my-lambda-function"
The ADOT layer handles resource attribute detection automatically. If you are not using ADOT, set resource attributes manually. cloud.provider is required. Set faas.id (a parseable Lambda ARN) for full platform identification; if faas.id is not available, set cloud.platform=aws_lambda instead:
export OTEL_RESOURCE_ATTRIBUTES="cloud.provider=aws,faas.id=arn:aws:lambda:us-east-1:123456789012:function:my-function"
| Attribute | Required | Description |
|---|
cloud.provider | Yes | Set to aws |
faas.id | Recommended | Lambda function ARN (preferred for platform identification) |
cloud.platform | Conditional | Set to aws_lambda if faas.id is not set |
cloud.region | No | AWS region |
faas.name | No | Function name |
faas.version | No | Function version |
faas.instance | No | Instance identifier |
faas.max_memory | No | Max memory configured (bytes) |
aws.log.group.names | No | CloudWatch log group names (enables trace-log correlation) |
aws.log.stream.names | No | CloudWatch log stream names |
ECS Fargate
ECS Fargate identification is driven by the task ARN and launch type, not by cloud.provider or cloud.platform. Configure the OpenTelemetry SDK to export traces directly from your ECS task:
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="${YOUR_ENDPOINT}"
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="dd-api-key=${DD_API_KEY},dd-otlp-source=serverless,compute_stats=true"
export OTEL_SERVICE_NAME="my-ecs-service"
export OTEL_RESOURCE_ATTRIBUTES="aws.ecs.task.arn=arn:aws:ecs:us-east-1:123456789012:task/my-cluster/1234567890abcdef,aws.ecs.launchtype=fargate"
| Attribute | Required | Description |
|---|
aws.ecs.task.arn | Yes | ECS task ARN |
aws.ecs.launchtype | Yes | Set to fargate (case-insensitive) |
cloud.provider | No | Defaults to aws |
cloud.platform | No | Defaults to aws_ecs |
cloud.region | No | AWS region |
cloud.availability_zone | No | Availability zone |
aws.ecs.cluster.arn | No | Cluster ARN |
aws.ecs.task.family | No | Task definition family |
aws.ecs.task.id | No | Task ID |
aws.ecs.task.revision | No | Task definition revision |
aws.log.group.names | No | CloudWatch log group names (enables trace-log correlation) |
aws.log.stream.names | No | CloudWatch log stream names |
The OpenTelemetry Collector's Azure resource detection processor only supports VMs. SDK-level Azure resource detectors support some platforms (Web Apps, Functions), but coverage varies by language SDK. Set cloud.provider, cloud.platform, and cloud.resource_id manually as the reliable path for all Azure serverless platforms.
Container Apps
Azure resource detector support for Container Apps varies by language SDK. Set resource attributes manually:
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="${YOUR_ENDPOINT}"
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="dd-api-key=${DD_API_KEY},dd-otlp-source=serverless,compute_stats=true"
export OTEL_SERVICE_NAME="my-container-app"
export OTEL_RESOURCE_ATTRIBUTES="cloud.provider=azure,cloud.platform=azure.container_apps,cloud.resource_id=/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.App/containerApps/{appName}"
Web Apps (App Service)
Use the Azure resource detector SDK package (coverage varies by language SDK) or set OTEL_RESOURCE_ATTRIBUTES manually:
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="${YOUR_ENDPOINT}"
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="dd-api-key=${DD_API_KEY},dd-otlp-source=serverless,compute_stats=true"
export OTEL_SERVICE_NAME="my-web-app"
export OTEL_RESOURCE_ATTRIBUTES="cloud.provider=azure,cloud.platform=azure.app_service,cloud.resource_id=/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Web/sites/{appName}"
Azure Functions
Use the Azure resource detector SDK package (coverage varies by language SDK) or set OTEL_RESOURCE_ATTRIBUTES manually:
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="${YOUR_ENDPOINT}"
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="dd-api-key=${DD_API_KEY},dd-otlp-source=serverless,compute_stats=true"
export OTEL_SERVICE_NAME="my-azure-function"
export OTEL_RESOURCE_ATTRIBUTES="cloud.provider=azure,cloud.platform=azure.functions,cloud.resource_id=/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Web/sites/{functionAppName}"
Resource attributes reference
| Platform | cloud.provider | cloud.platform | cloud.resource_id |
|---|
| Container Apps | azure | azure.container_apps | /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.App/containerApps/{appName} |
| Web Apps | azure | azure.app_service | /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Web/sites/{appName} |
| Azure Functions | azure | azure.functions | /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Web/sites/{functionAppName} |
GCP resource detection works automatically with the GCP Resource Detector SDK package. Add it to your application dependencies to populate resource attributes without manual configuration.
Cloud Run and Cloud Run Functions
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="${YOUR_ENDPOINT}"
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="dd-api-key=${DD_API_KEY},dd-otlp-source=serverless,compute_stats=true"
export OTEL_SERVICE_NAME="my-cloud-run-service"
The GCP Resource Detector SDK automatically populates: cloud.account.id, cloud.platform, cloud.provider, cloud.region, faas.id, faas.instance, faas.name, faas.version.
GKE Autopilot
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="${YOUR_ENDPOINT}"
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="dd-api-key=${DD_API_KEY},dd-otlp-source=serverless,compute_stats=true"
export OTEL_SERVICE_NAME="my-gke-service"
The GCP Resource Detector SDK automatically populates: cloud.account.id, cloud.platform, cloud.provider, cloud.region, host.id, k8s.cluster.name.
Resource attributes reference
| Platform | Attributes populated by GCP Resource Detector |
|---|
| Cloud Run / Cloud Run Functions | cloud.account.id, cloud.platform, cloud.provider, cloud.region, faas.id, faas.instance, faas.name, faas.version |
| GKE Autopilot | cloud.account.id, cloud.platform, cloud.provider, cloud.region, host.id, k8s.cluster.name |
Further reading
Additional helpful documentation, links, and articles: