LaunchDarkly’s observability features are publicly available in early access. Enable observability in the billing page.
They currently require the LaunchDarkly observability SDKs and the JavaScript, React Web, or Vue SDK.
If you are interested in participating in the Early Access Program for our upcoming observability plugins for server-side SDKs, sign up here.
This topic explains how to send traces, metrics, and logs from the Datadog Agent to LaunchDarkly’s observability features.
LaunchDarkly’s OpenTelemetry Collector includes a Datadog-compatible receiver. If you already run the Datadog Agent in your infrastructure, you can configure it to send APM traces, metrics, and logs to LaunchDarkly without changing your application instrumentation. Once received, this telemetry is available in the Traces, Logs, and observability dashboards in the LaunchDarkly UI.
Before you configure Datadog Agent ingestion, you must:
To find your client-side ID:
To send telemetry to LaunchDarkly, configure the Datadog Agent to use LaunchDarkly’s 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:8126
To configure the Datadog Agent using the datadog.yaml configuration file, include these lines:
If you run the Datadog Agent in a container, you can use environment variables to provide the configuration:
If you run the Datadog Agent as a Docker container, add the configuration to your docker-compose.yml file:
The Datadog Agent requires a DD_API_KEY value to start, even when routing to a non-Datadog endpoint. You can use any non-empty placeholder string. LaunchDarkly does not validate or use this value.
The examples above replace the default Datadog intake with LaunchDarkly’s 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’s observability features and guarded rollouts.
To learn how to configure dual shipping, read Dual Shipping in the Datadog documentation.
When configuring dual shipping, use https://datadog.observability.app.launchdarkly.com:8126 as the additional endpoint for APM traces, metrics, and logs.
LaunchDarkly uses the launchdarkly.project_id resource attribute to route telemetry to the correct project. Set this to your LaunchDarkly client-side ID.
You can set this attribute in your application’s OpenTelemetry SDK configuration, or use the OTEL_RESOURCE_ATTRIBUTES environment variable for services that send data through the agent:
Alternatively, if you use the OpenTelemetry Collector in front of the Datadog Agent, you can inject this attribute using a resource processor. To learn more, read OpenTelemetry in server-side SDKs.
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:
This example uses a BeforeEvaluation hook to start a Datadog span with flag metadata, and an AfterEvaluation hook to record the result and finish the span.
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:
Configure the Datadog tracer in your application to send traces to LaunchDarkly’s Datadog-compatible endpoint. Set the X-LaunchDarkly-Project global tag to your LaunchDarkly project ID so that traces are routed to the correct project:
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:
To learn more about setting up guarded rollouts, read Creating guarded rollouts.
The Datadog Agent sends the following telemetry types to LaunchDarkly:
After you configure the Datadog Agent, telemetry begins flowing to LaunchDarkly.
To verify that traces are being received:
To verify that logs are being received:
It may take a few minutes for data to appear after you first configure the agent.
You can configure ingestion filters to control which logs are stored in LaunchDarkly. This is useful for reducing noise or staying within your observability quotas.
To learn more, read Filters.