---
title: OTLP Intake for Serverless
description: >-
  Send traces from AWS Lambda, ECS Fargate, Azure Functions, Cloud Run, and
  other serverless platforms directly to Datadog without a Datadog Agent or
  Collector.
breadcrumbs: >-
  Docs > OpenTelemetry in Datadog > Send OpenTelemetry Data to Datadog > Datadog
  OTLP Intake Endpoint > OTLP Intake for Serverless
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# OTLP Intake for Serverless

## Overview{% #overview %}

Send traces from serverless workloads directly to Datadog over HTTP/protobuf, without requiring a [Datadog Agent](https://docs.datadoghq.com/opentelemetry/otlp_ingest_in_the_agent.md) or OpenTelemetry Collector. If your platform appears in the [Managed platforms](https://docs.datadoghq.com/opentelemetry/setup/otlp_ingest/managed_platforms.md) table, use its dedicated endpoint instead.

Serverless workloads can also send logs and metrics through the general [OTLP logs](https://docs.datadoghq.com/opentelemetry/setup/otlp_ingest/logs.md) and [OTLP metrics](https://docs.datadoghq.com/opentelemetry/setup/otlp_ingest/metrics.md) 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

{% alert level="info" %}
Use direct ingest when running a Collector is impractical (for example, Lambda). If you can run a Collector, see [OpenTelemetry Collector](https://docs.datadoghq.com/opentelemetry/setup/collector_exporter.md) for metadata enrichment, normalization, and centralized sampling.
{% /alert %}

## Prerequisites{% #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](https://docs.datadoghq.com/tracing/metrics.md).

**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.

```shell
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="<YOUR_OTLP_TRACE_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{% #setup %}

{% alert level="info" %}
Based on your [Datadog site](https://docs.datadoghq.com/getting_started/site.md), which is <YOUR_DATADOG_DATACENTER>: Replace `${YOUR_ENDPOINT}` with <YOUR_OTLP_TRACE_ENDPOINT> in the following examples.
{% /alert %}

Select your cloud provider for platform-specific resource attribute configuration:

{% tab title="AWS" %}
### Lambda{% #lambda %}

The [AWS Distro for OpenTelemetry (ADOT) Lambda layer](https://aws-otel.github.io/docs/getting-started/lambda) provides automatic instrumentation and resource detection for Lambda functions.

Add the ADOT layer to your Lambda function and configure the following environment variables:

```shell
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:

```shell
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 %}

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:

```shell
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                                |

{% /tab %}

{% tab title="Azure" %}

{% alert level="warning" %}
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.
{% /alert %}

### Container Apps{% #container-apps %}

Azure resource detector support for Container Apps varies by language SDK. Set resource attributes manually:

```shell
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){% #web-apps-app-service %}

Use the Azure resource detector SDK package (coverage varies by language SDK) or set `OTEL_RESOURCE_ATTRIBUTES` manually:

```shell
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{% #azure-functions %}

Use the Azure resource detector SDK package (coverage varies by language SDK) or set `OTEL_RESOURCE_ATTRIBUTES` manually:

```shell
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{% #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}` |

{% /tab %}

{% tab title="GCP" %}
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{% #cloud-run-and-cloud-run-functions %}

```shell
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{% #gke-autopilot %}

```shell
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{% #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`                           |

{% /tab %}

## Further reading{% #further-reading %}

- [Datadog OTLP Intake Endpoint](https://docs.datadoghq.com/opentelemetry/setup/otlp_ingest.md)
- [Datadog Serverless Monitoring](https://docs.datadoghq.com/serverless.md)
