Skip to content

Commit 28fcc56

Browse files
authored
OpenTelemetry: Update the HTTP path and headers for logs and traces (#30934)
* OpenTelemetry: Update the HTTP path and headers for logs and traces The intake now handles the standard OpenTelemetry HTTP paths without the need of additional header. https://opentelemetry.io/docs/specs/otlp/#otlphttp-request * cosmetics: replace spaces by tabs in golang
1 parent ddca8ce commit 28fcc56

File tree

3 files changed

+13
-21
lines changed

3 files changed

+13
-21
lines changed

assets/scripts/config/regions.config.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,10 @@ export default {
340340
gov: 'https://ip-ranges.ddog-gov.com'
341341
},
342342
otlp_trace_endpoint: {
343-
us: 'https://trace.agent.datadoghq.com/api/v0.2/traces',
344-
us3: 'https://trace.agent.us3.datadoghq.com/api/v0.2/traces',
345-
us5: 'https://trace.agent.us5.datadoghq.com/api/v0.2/traces',
346-
eu: 'https://trace.agent.datadoghq.eu/api/v0.2/traces',
343+
us: 'https://trace.agent.datadoghq.com/v1/traces',
344+
us3: 'https://trace.agent.us3.datadoghq.com/v1/traces',
345+
us5: 'https://trace.agent.us5.datadoghq.com/v1/traces',
346+
eu: 'https://trace.agent.datadoghq.eu/v1/traces',
347347
ap1: 'Datadog OTLP traces intake endpoint is not supported for AP1',
348348
ap2: 'Datadog OTLP traces intake endpoint is not supported for AP2'
349349
},
@@ -356,10 +356,10 @@ export default {
356356
ap2: 'Datadog OTLP metrics intake endpoint is not supported for AP2'
357357
},
358358
otlp_logs_endpoint: {
359-
us: 'https://http-intake.logs.datadoghq.com/api/v2/logs',
360-
us3: 'https://http-intake.logs.us3.datadoghq.com/api/v2/logs',
361-
us5: 'https://http-intake.logs.us5.datadoghq.com/api/v2/logs',
362-
eu: 'https://http-intake.logs.datadoghq.eu/api/v2/logs',
359+
us: 'https://http-intake.logs.datadoghq.com/v1/logs',
360+
us3: 'https://http-intake.logs.us3.datadoghq.com/v1/logs',
361+
us5: 'https://http-intake.logs.us5.datadoghq.com/v1/logs',
362+
eu: 'https://http-intake.logs.datadoghq.eu/v1/logs',
363363
ap1: 'Datadog OTLP logs intake endpoint is not supported for AP1',
364364
ap2: 'Datadog OTLP logs intake endpoint is not supported for AP2'
365365
},

content/en/opentelemetry/setup/agentless/logs.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ If you are using [OpenTelemetry automatic instrumentation][3], set the following
3838
```shell
3939
export OTEL_EXPORTER_OTLP_LOGS_PROTOCOL="http/protobuf"
4040
export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT="${YOUR_ENDPOINT}" // Replace this with the correct endpoint
41-
export OTEL_EXPORTER_OTLP_LOGS_HEADERS="dd-protocol=otlp,dd-api-key=${DD_API_KEY}"
41+
export OTEL_EXPORTER_OTLP_LOGS_HEADERS="dd-api-key=${DD_API_KEY}"
4242
```
4343

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

5757
OtlpHttpLogRecordExporter exporter = OtlpHttpLogRecordExporter.builder()
5858
.setEndpoint("${YOUR_ENDPOINT}") // Replace this with the correct endpoint
59-
.addHeader("dd-protocol", "otlp")
6059
.addHeader("dd-api-key", System.getenv("DD_API_KEY"))
6160
.build();
6261
```
@@ -71,10 +70,9 @@ import "go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp"
7170
logExporter, err := otlploghttp.New(
7271
ctx,
7372
otlploghttp.WithEndpointURL("${YOUR_ENDPOINT}"), // Replace this with the correct endpoint, minus the URL path
74-
otlploghttp.WithURLPath("/api/v2/logs"),
73+
otlploghttp.WithURLPath("/v1/logs"),
7574
otlploghttp.WithHeaders(
7675
map[string]string{
77-
"dd-protocol": "otlp",
7876
"dd-api-key": os.Getenv("DD_API_KEY"),
7977
}),
8078
)
@@ -93,7 +91,6 @@ exporters:
9391
otlphttp:
9492
logs_endpoint: ${YOUR_ENDPOINT} // Replace this with the correct endpoint
9593
headers:
96-
dd-protocol: "otlp"
9794
dd-api-key: ${env:DD_API_KEY}
9895

9996
service:

content/en/opentelemetry/setup/agentless/traces.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ If you are using [OpenTelemetry automatic instrumentation][3], set the following
4646
```shell
4747
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="http/protobuf"
4848
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="{{< region-param key="otlp_trace_endpoint" >}}"
49-
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="dd-protocol=otlp,dd-api-key=${DD_API_KEY},dd-otlp-source=${YOUR_SITE}"
49+
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="dd-api-key=${DD_API_KEY},dd-otlp-source=${YOUR_SITE}"
5050
```
5151

5252
<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>
@@ -68,7 +68,6 @@ const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-proto'
6868
const exporter = new OTLPTraceExporter({
6969
url: '${YOUR_ENDPOINT}', // Replace this with the correct endpoint
7070
headers: {
71-
'dd-protocol': 'otlp',
7271
'dd-api-key': process.env.DD_API_KEY,
7372
'dd-otel-span-mapping': '{span_name_as_resource_name: true}',
7473
'dd-otlp-source': '${YOUR_SITE}', // Replace with the specific value provided by Datadog for your organization
@@ -88,7 +87,6 @@ import io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporter;
8887

8988
OtlpHttpSpanExporter exporter = OtlpHttpSpanExporter.builder()
9089
.setEndpoint("${YOUR_ENDPOINT}") // Replace this with the correct endpoint
91-
.addHeader("dd-protocol", "otlp")
9290
.addHeader("dd-api-key", System.getenv("DD_API_KEY"))
9391
.addHeader("dd-otel-span-mapping", "{span_name_as_resource_name: true}")
9492
.addHeader("dd-otlp-source", "${YOUR_SITE}") // Replace with the specific value provided by Datadog for your organization
@@ -108,13 +106,12 @@ import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp"
108106
traceExporter, err := otlptracehttp.New(
109107
ctx,
110108
otlptracehttp.WithEndpoint("${YOUR_ENDPOINT}"), // Replace this with the correct endpoint
111-
otlptracehttp.WithURLPath("/api/v0.2/traces"),
109+
otlptracehttp.WithURLPath("/v1/traces"),
112110
otlptracehttp.WithHeaders(
113111
map[string]string{
114-
"dd-protocol": "otlp",
115112
"dd-api-key": os.Getenv("DD_API_KEY"),
116113
"dd-otel-span-mapping": "{span_name_as_resource_name: true}",
117-
"dd-otlp-source": "${YOUR_SITE}", // Replace with the specific value provided by Datadog for your organization
114+
"dd-otlp-source": "${YOUR_SITE}", // Replace with the specific value provided by Datadog for your organization
118115
}),
119116
)
120117
```
@@ -132,7 +129,6 @@ from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExport
132129
exporter = OTLPSpanExporter(
133130
endpoint="${YOUR_ENDPOINT}", # Replace this with the correct endpoint
134131
headers={
135-
"dd-protocol": "otlp",
136132
"dd-api-key": os.environ.get("DD_API_KEY"),
137133
"dd-otel-span-mapping": "{span_name_as_resource_name: true}",
138134
"dd-otlp-source": "${YOUR_SITE}" # Replace with the specific value provided by Datadog for your organization
@@ -179,7 +175,6 @@ exporters:
179175
otlphttp:
180176
traces_endpoint: {{< region-param key="otlp_trace_endpoint" >}}
181177
headers:
182-
dd-protocol: "otlp"
183178
dd-api-key: ${env:DD_API_KEY}
184179
dd-otel-span-mapping: "{span_name_as_resource_name: false}"
185180
dd-otlp-source: "${YOUR_SITE}", # Replace with the specific value provided by Datadog for your organization

0 commit comments

Comments
 (0)