This feature is in Early AccessLaunchDarkly observability features are publicly available in early access. Enable observability in the billing page.Datadog Agent ingestion is not tied to a specific SDK. The LaunchDarkly Datadog-compatible endpoint accepts any traces, metrics, and logs that the Datadog Agent forwards, regardless of which Datadog tracing library, SDK, or integration instruments your applications. You do not need the LaunchDarkly observability SDKs to use it. To use ingested traces with guarded rollouts, your traces must include feature flag evaluation data. To learn how, read Attaching feature flag context to traces.
Prerequisites
Before you configure Datadog Agent ingestion, you must:- Have LaunchDarkly observability enabled for your project
- Have the Datadog Agent v6.0 or later installed and running in your infrastructure
- Know your LaunchDarkly client-side ID
- In the LaunchDarkly UI, click the project dropdown to open the project menu.
- Select Project settings.
- Click Environments.
- Find the environment you want to use and copy the Client-side ID value.
Configure the Datadog Agent
To send telemetry to LaunchDarkly, configure the Datadog Agent to use the LaunchDarkly Datadog-compatible endpoint. You can replace the standard Datadog intake, or send data to both Datadog and LaunchDarkly simultaneously using dual shipping.Endpoint:datadog.observability.app.launchdarkly.com:8126Configure using the agent configuration file
To configure the Datadog Agent using thedatadog.yaml configuration file, include these lines:Configure using environment variables
If you run the Datadog Agent in a container, you can use environment variables to provide the configuration:Configure using Docker Compose
If you run the Datadog Agent as a Docker container, add the configuration to yourdocker-compose.yml file:Sending data to both Datadog and LaunchDarkly
The examples above replace the default Datadog intake with the LaunchDarkly endpoint. If you want to continue sending data to Datadog while also sending it to LaunchDarkly, you can configure the Datadog Agent to dual ship telemetry to both destinations.Dual shipping lets you keep your existing Datadog dashboards, alerts, and workflows while also using LaunchDarkly observability features and guarded rollouts.To learn how to configure dual shipping, read Dual Shipping in the Datadog documentation.When configuring dual shipping, usehttps://datadog.observability.app.launchdarkly.com:8126 as the additional endpoint for APM traces, metrics, and logs.Associate telemetry with your LaunchDarkly project
LaunchDarkly uses thelaunchdarkly.project_id attribute to route telemetry to the correct project. Set it to your LaunchDarkly client-side ID. LaunchDarkly does not authenticate at the ingestion endpoint, so this attribute associates your telemetry with your project. The attribute must be present in your spans and logs, and not only as a host-level agent tag.How you set the attribute depends on how your services are instrumented:- Applications that use the Datadog tracer (
dd-trace) should set the attribute as a global span tag. You can implement this without changing application code by setting theDD_TAGSenvironment variable on your service. This tags every span with the attribute, and the tags also flow through to your logs:
- Applications that use an OpenTelemetry SDK should set the attribute as a resource attribute in the
OTEL_RESOURCE_ATTRIBUTESenvironment variable:
resource processor. To learn more, read OpenTelemetry in server-side SDKs.Attaching feature flag context to traces
To use Datadog trace data with LaunchDarkly features like guarded rollouts and OpenTelemetry autogenerated metrics, your traces must include feature flag evaluation data. LaunchDarkly uses this data to correlate traces with specific flag evaluations and contexts.You can attach feature flag context to your Datadog traces by creating a custom SDK hook. The hook instruments each flag evaluation as a child span on your existing Datadog traces, adding attributes that LaunchDarkly uses to connect traces to flag evaluations.The hook must set the following span attributes on each flag evaluation:| Attribute | Description |
|---|---|
feature_flag.key | The key of the evaluated flag. |
feature_flag.context.id | The fully-qualified key of the LaunchDarkly context. |
feature_flag.contextKeys | A JSON object mapping each context kind to its key, for example . |
feature_flag.provider.name | Set to LaunchDarkly. |
feature_flag.result.value | The string representation of the evaluation result. |
Go example
This example uses aBeforeEvaluation hook to start a Datadog span with flag metadata, and an AfterEvaluation hook to record the result and finish the span.Expand Go hook implementation
Expand Go hook implementation
First, define the hook:Then register the hook when you initialize the LaunchDarkly client:When you evaluate flags, use the context-aware variation methods to pass the request context through to the hook:
Configuring the Datadog tracer
Configure the Datadog tracer in your application to send traces to the LaunchDarkly Datadog-compatible endpoint. Set thelaunchdarkly.project_id global tag to your LaunchDarkly client-side ID so that traces are routed to the correct project. If you prefer not to change your application code, set the same tag using the DD_TAGS environment variable instead, as described in Associate telemetry with your LaunchDarkly project.Using flag data with guarded rollouts
After you configure the hook and tracer, LaunchDarkly automatically processes your Datadog trace data and associates it with the feature flags and contexts in your evaluations. This enables you to:- Use OpenTelemetry autogenerated metrics, such as HTTP error rates and latencies, with guarded rollouts
- Monitor how flag changes impact your application performance in Traces
- Correlate errors and latency regressions with specific flag evaluations and context attributes
What data is collected
The Datadog Agent sends the following telemetry types to LaunchDarkly:- Traces: APM traces from your instrumented services, visible in Traces.
- Metrics: Infrastructure and application metrics.
- Logs: Application logs collected by the agent log collection feature, visible in Logs.
Verify that data is being received
After you configure the Datadog Agent, telemetry begins flowing to LaunchDarkly.To verify that traces are being received:- Open the Telemetry section and navigate to the Traces list.
- Search for traces from your Datadog-instrumented services.
- Open the Telemetry section and navigate to the Logs list.
- Search for logs from your services.