Skip to content

OpenTelemetry: Update the HTTP path and headers for logs and traces #30934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions assets/scripts/config/regions.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,10 @@ export default {
gov: 'https://ip-ranges.ddog-gov.com'
},
otlp_trace_endpoint: {
us: 'https://trace.agent.datadoghq.com/api/v0.2/traces',
us3: 'https://trace.agent.us3.datadoghq.com/api/v0.2/traces',
us5: 'https://trace.agent.us5.datadoghq.com/api/v0.2/traces',
eu: 'https://trace.agent.datadoghq.eu/api/v0.2/traces',
us: 'https://trace.agent.datadoghq.com/v1/traces',
us3: 'https://trace.agent.us3.datadoghq.com/v1/traces',
us5: 'https://trace.agent.us5.datadoghq.com/v1/traces',
eu: 'https://trace.agent.datadoghq.eu/v1/traces',
ap1: 'Datadog OTLP traces intake endpoint is not supported for AP1',
ap2: 'Datadog OTLP traces intake endpoint is not supported for AP2'
},
Expand All @@ -356,10 +356,10 @@ export default {
ap2: 'Datadog OTLP metrics intake endpoint is not supported for AP2'
},
otlp_logs_endpoint: {
us: 'https://http-intake.logs.datadoghq.com/api/v2/logs',
us3: 'https://http-intake.logs.us3.datadoghq.com/api/v2/logs',
us5: 'https://http-intake.logs.us5.datadoghq.com/api/v2/logs',
eu: 'https://http-intake.logs.datadoghq.eu/api/v2/logs',
us: 'https://http-intake.logs.datadoghq.com/v1/logs',
us3: 'https://http-intake.logs.us3.datadoghq.com/v1/logs',
us5: 'https://http-intake.logs.us5.datadoghq.com/v1/logs',
eu: 'https://http-intake.logs.datadoghq.eu/v1/logs',
ap1: 'Datadog OTLP logs intake endpoint is not supported for AP1',
ap2: 'Datadog OTLP logs intake endpoint is not supported for AP2'
},
Expand Down
7 changes: 2 additions & 5 deletions content/en/opentelemetry/setup/agentless/logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ If you are using [OpenTelemetry automatic instrumentation][3], set the following
```shell
export OTEL_EXPORTER_OTLP_LOGS_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT="${YOUR_ENDPOINT}" // Replace this with the correct endpoint
export OTEL_EXPORTER_OTLP_LOGS_HEADERS="dd-protocol=otlp,dd-api-key=${DD_API_KEY}"
export OTEL_EXPORTER_OTLP_LOGS_HEADERS="dd-api-key=${DD_API_KEY}"
```

#### Manual instrumentation
Expand All @@ -56,7 +56,6 @@ import io.opentelemetry.exporter.otlp.http.logs.OtlpHttpLogRecordExporter;

OtlpHttpLogRecordExporter exporter = OtlpHttpLogRecordExporter.builder()
.setEndpoint("${YOUR_ENDPOINT}") // Replace this with the correct endpoint
.addHeader("dd-protocol", "otlp")
.addHeader("dd-api-key", System.getenv("DD_API_KEY"))
.build();
```
Expand All @@ -71,10 +70,9 @@ import "go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp"
logExporter, err := otlploghttp.New(
ctx,
otlploghttp.WithEndpointURL("${YOUR_ENDPOINT}"), // Replace this with the correct endpoint, minus the URL path
otlploghttp.WithURLPath("/api/v2/logs"),
otlploghttp.WithURLPath("/v1/logs"),
otlploghttp.WithHeaders(
map[string]string{
"dd-protocol": "otlp",
"dd-api-key": os.Getenv("DD_API_KEY"),
}),
)
Expand All @@ -93,7 +91,6 @@ exporters:
otlphttp:
logs_endpoint: ${YOUR_ENDPOINT} // Replace this with the correct endpoint
headers:
dd-protocol: "otlp"
dd-api-key: ${env:DD_API_KEY}

service:
Expand Down
11 changes: 3 additions & 8 deletions content/en/opentelemetry/setup/agentless/traces.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ If you are using [OpenTelemetry automatic instrumentation][3], set the following
```shell
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="{{< region-param key="otlp_trace_endpoint" >}}"
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="dd-protocol=otlp,dd-api-key=${DD_API_KEY},dd-otlp-source=${YOUR_SITE}"
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="dd-api-key=${DD_API_KEY},dd-otlp-source=${YOUR_SITE}"
```

<div class="alert alert-info">The value for <code>dd-otlp-source</code> should be provided to you by Datadog after being allowlisted for the intake endpoint. This is a specific identifier assigned to your organization.</div>
Expand All @@ -68,7 +68,6 @@ const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-proto'
const exporter = new OTLPTraceExporter({
url: '${YOUR_ENDPOINT}', // Replace this with the correct endpoint
headers: {
'dd-protocol': 'otlp',
'dd-api-key': process.env.DD_API_KEY,
'dd-otel-span-mapping': '{span_name_as_resource_name: true}',
'dd-otlp-source': '${YOUR_SITE}', // Replace with the specific value provided by Datadog for your organization
Expand All @@ -88,7 +87,6 @@ import io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporter;

OtlpHttpSpanExporter exporter = OtlpHttpSpanExporter.builder()
.setEndpoint("${YOUR_ENDPOINT}") // Replace this with the correct endpoint
.addHeader("dd-protocol", "otlp")
.addHeader("dd-api-key", System.getenv("DD_API_KEY"))
.addHeader("dd-otel-span-mapping", "{span_name_as_resource_name: true}")
.addHeader("dd-otlp-source", "${YOUR_SITE}") // Replace with the specific value provided by Datadog for your organization
Expand All @@ -108,13 +106,12 @@ import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp"
traceExporter, err := otlptracehttp.New(
ctx,
otlptracehttp.WithEndpoint("${YOUR_ENDPOINT}"), // Replace this with the correct endpoint
otlptracehttp.WithURLPath("/api/v0.2/traces"),
otlptracehttp.WithURLPath("/v1/traces"),
otlptracehttp.WithHeaders(
map[string]string{
"dd-protocol": "otlp",
"dd-api-key": os.Getenv("DD_API_KEY"),
"dd-otel-span-mapping": "{span_name_as_resource_name: true}",
"dd-otlp-source": "${YOUR_SITE}", // Replace with the specific value provided by Datadog for your organization
"dd-otlp-source": "${YOUR_SITE}", // Replace with the specific value provided by Datadog for your organization
}),
)
```
Expand All @@ -132,7 +129,6 @@ from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExport
exporter = OTLPSpanExporter(
endpoint="${YOUR_ENDPOINT}", # Replace this with the correct endpoint
headers={
"dd-protocol": "otlp",
"dd-api-key": os.environ.get("DD_API_KEY"),
"dd-otel-span-mapping": "{span_name_as_resource_name: true}",
"dd-otlp-source": "${YOUR_SITE}" # Replace with the specific value provided by Datadog for your organization
Expand Down Expand Up @@ -179,7 +175,6 @@ exporters:
otlphttp:
traces_endpoint: {{< region-param key="otlp_trace_endpoint" >}}
headers:
dd-protocol: "otlp"
dd-api-key: ${env:DD_API_KEY}
dd-otel-span-mapping: "{span_name_as_resource_name: false}"
dd-otlp-source: "${YOUR_SITE}", # Replace with the specific value provided by Datadog for your organization
Expand Down
Loading