buildDatadogExporter

fun buildDatadogExporter(datadogApiKey: String? = null, datadogSite: String? = null, timeout: Duration = 10.seconds): SpanExporter(source)

Builds a Datadog-ready SpanExporter that sends OTLP traces directly to Datadog's intake endpoint.

Returns the exporter without registering it, so callers can wrap it with additional decorators before calling OpenTelemetryConfig.addSpanExporter.

Requires a DD_API_KEY environment variable (or explicit datadogApiKey parameter). The dd-otlp-source: llmobs header routes spans to the LLM Observability product.

Return

a SpanExporter configured for Datadog direct OTLP intake.

Parameters

datadogApiKey

Datadog API key. Falls back to DD_API_KEY environment variable.

datadogSite

Datadog site (e.g. datadoghq.com, datadoghq.eu). Falls back to DD_SITE environment variable, defaults to datadoghq.com.

timeout

OpenTelemetry SpanExporter timeout.

See also