Datadog Agent ingestion
This feature is in Early Access
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.
Overview
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.
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
To find your 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 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: otel.observability.app.launchdarkly.com:8126
Configure using the agent configuration file
To configure the Datadog Agent using the datadog.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 your docker-compose.yml file:
DD_API_KEY is required
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.
Sending data to both Datadog and LaunchDarkly
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 http://otel.observability.app.launchdarkly.com:8126 as the additional endpoint for APM traces, metrics, and logs.
Associate telemetry with your LaunchDarkly project
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.
Attaching feature flag context to traces
To use Datadog trace data with LaunchDarkly features like guarded rollouts and 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:
Go example
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.
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 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:
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 autogenerated OpenTelemetry 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
To learn more about setting up guarded rollouts, read Creating guarded rollouts.
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:
- In the LaunchDarkly UI, expand Observe in the left navigation.
- Click Traces.
- Look for traces from your Datadog-instrumented services.
To verify that logs are being received:
- In the LaunchDarkly UI, expand Observe in the left navigation.
- Click Logs.
- Look for logs from your services.
It may take a few minutes for data to appear after you first configure the agent.
Filtering ingested data
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.