Skip to content
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
4 changes: 4 additions & 0 deletions libdd-data-pipeline/src/otlp/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ pub struct OtlpTraceConfig {
/// Protocol (for future use; currently only HttpJson is supported).
#[allow(dead_code)]
pub(crate) protocol: OtlpProtocol,
/// When `true`, does not add DD-specific per-span attributes to the OTLP payload.
// These attributes are: (`service.name`, `operation.name`, `resource.name`,
// `span.type`, `error.msg`, `error.message`, `span.kind`)
pub otel_trace_semantics_enabled: bool,
}

/// Parsed OTLP trace-metrics exporter configuration.
Expand Down
9 changes: 8 additions & 1 deletion libdd-data-pipeline/src/trace_exporter/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,13 @@ impl TraceExporterBuilder {
self
}

/// Strip Datadog-specific `dd.*`/`_dd.*` data-point attributes from the exported histogram.
/// Enables OTel trace semantics, which does not add DD-specific per-span attributes
/// (`service.name`, `operation.name`, `resource.name`, `span.type`, `error.msg`,
/// `error.message`, `span.kind`) to the OTLP payload.
/// Also strips Datadog-specific `dd.*`/`_dd.*` data-point attributes from the exported
/// histogram. This is useful when exporting to a native OTel backend that does not expect
/// Datadog semantics. The host language tracer is expected to observe this behavior by
/// setting the `DD_TRACE_OTEL_SEMANTICS_ENABLED` environment variable to `true`.
pub fn enable_otel_trace_semantics(&mut self) -> &mut Self {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to add a corresponding function to the FFI API?

@zacharycmontoya zacharycmontoya Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll follow up and post a change to the FFI API as a separate PR, as this is only consumed in dd-trace-py for now

self.otel_trace_semantics_enabled = true;
self
Expand Down Expand Up @@ -488,6 +494,7 @@ impl TraceExporterBuilder {
headers: build_otlp_header_map(self.otlp_headers),
timeout: otlp_timeout,
protocol: OtlpProtocol::HttpJson,
otel_trace_semantics_enabled: self.otel_trace_semantics_enabled,
});

let otlp_metrics_config = self.otlp_metrics_endpoint.map(|url| OtlpMetricsConfig {
Expand Down
3 changes: 2 additions & 1 deletion libdd-data-pipeline/src/trace_exporter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,8 @@ impl<C: HttpClientCapability + SleepCapability + MaybeSend + Sync + 'static> Tra
r.client_computed_stats = self.otlp_stats_enabled;
r
};
let request = map_traces_to_otlp(traces, &resource_info);
let request =
map_traces_to_otlp(traces, &resource_info, config.otel_trace_semantics_enabled);
let json_body = serde_json::to_vec(&request).map_err(|e| {
error!("OTLP JSON serialization error: {e}");
TraceExporterError::Internal(InternalErrorKind::InvalidWorkerState(e.to_string()))
Expand Down
Loading
Loading