For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign inTry it free
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
  • Get started
    • Overview
    • Onboarding
    • Get started
    • Launch Insights
    • LaunchDarkly architecture
    • LaunchDarkly vocabulary
  • AgentControl
    • AgentControl
    • Manage AgentControl
  • Feature flags
    • Create flags
    • Target with flags
    • Flag templates
    • Manage flags
    • Code references
    • Contexts
    • Segments
  • Releases
    • Releasing features with LaunchDarkly
    • Release policies
    • Percentage rollouts
    • Progressive rollouts
    • Guarded rollouts
    • Feature monitoring
    • Release pipelines
    • Engineering insights
    • Release management tools
    • Applications and app versions
    • Change history
    • Restoring previous flag versions
  • Observability
    • Observability
    • Session replay
    • Error monitoring
    • Logs
    • Traces
    • Observability metrics
    • Product analytics events
    • LLM observability
    • Alerts
    • Dashboards
    • Service map
    • Vega for auto-remediation
    • Observability MCP server
    • Search specification
    • Observability settings
    • Observability integrations
      • AWS CloudWatch Metrics
      • AWS FireLens
      • Azure Monitor
      • Datadog Agent ingestion
      • Fluent Bit
      • Syslog log drain
      • Vercel
  • Experimentation
    • Experimentation
    • Experiment metric types
    • Experiment configuration
    • Managing experiments
    • Analyzing experiments
    • Multi-armed bandits
    • Holdouts
  • Metrics and events
    • Metrics in LaunchDarkly
    • Creating metrics
    • Metric groups
    • Events
    • Autogenerated metrics
  • Warehouse native
    • Warehouse native metrics
    • Setting up external warehouses
    • Creating experiments using warehouse native metrics
  • Infrastructure
    • Connect apps and services to LaunchDarkly
    • LaunchDarkly in China and Pakistan
    • LaunchDarkly in the European Union (EU)
    • LaunchDarkly in federal environments
    • Public IP list
  • Your account
    • Projects
    • Views
    • Environments
    • Tags
    • Teams
    • Members
    • Roles
    • Account security
    • Feature previews
    • Billing and usage
    • Changelog
Sign inTry it free
LogoLogo
On this page
  • Overview
  • Prerequisites
  • Configure the Datadog Agent
  • Configure using the agent configuration file
  • Configure using environment variables
  • Configure using Docker Compose
  • Sending data to both Datadog and LaunchDarkly
  • Associate telemetry with your LaunchDarkly project
  • Attaching feature flag context to traces
  • Go example
  • Configuring the Datadog tracer
  • Using flag data with guarded rollouts
  • What data is collected
  • Verify that data is being received
  • Filtering ingested data
ObservabilityObservability integrations

Datadog Agent ingestion

Was this page helpful?
Previous

Fluent Bit

Next
Built with
Observability is not available in LaunchDarkly's European Union (EU) instance
To learn more, read LaunchDarkly in the European Union (EU).
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:

  1. In the LaunchDarkly UI, click the project dropdown to open the project menu.
  2. Select Project settings.
  3. Click Environments.
  4. 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: datadog.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:

datadog.yaml configuration
1apm_config:
2 enabled: true
3 apm_dd_url: https://datadog.observability.app.launchdarkly.com:8126
4
5logs_config:
6 logs_dd_url: datadog.observability.app.launchdarkly.com:8126
7 use_http: true
8 expected_tags_duration: "87600h"
9
10dd_url: https://datadog.observability.app.launchdarkly.com:8126

Configure using environment variables

If you run the Datadog Agent in a container, you can use environment variables to provide the configuration:

Environment variable configuration
$DD_APM_ENABLED=true
$DD_APM_DD_URL=https://datadog.observability.app.launchdarkly.com:8126
$DD_DD_URL=https://datadog.observability.app.launchdarkly.com:8126
$DD_LOGS_CONFIG_EXPECTED_TAGS_DURATION=87600h

Configure using Docker Compose

If you run the Datadog Agent as a Docker container, add the configuration to your docker-compose.yml file:

docker-compose.yml configuration
1services:
2 datadog-agent:
3 image: gcr.io/datadoghq/agent:latest
4 environment:
5 - DD_APM_ENABLED=true
6 - DD_APM_DD_URL=https://datadog.observability.app.launchdarkly.com:8126
7 - DD_DD_URL=https://datadog.observability.app.launchdarkly.com:8126
8 - DD_LOGS_CONFIG_EXPECTED_TAGS_DURATION=87600h
9 - DD_API_KEY=placeholder
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 https://datadog.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:

Environment variable
$export OTEL_RESOURCE_ATTRIBUTES="launchdarkly.project_id=YOUR_CLIENT_SIDE_ID"

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 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:

AttributeDescription
feature_flag.keyThe key of the evaluated flag.
feature_flag.context.idThe fully-qualified key of the LaunchDarkly context.
feature_flag.contextKeysA JSON object mapping each context kind to its key, for example {"user":"user-123"}.
feature_flag.provider.nameSet to LaunchDarkly.
feature_flag.result.valueThe string representation of the evaluation result.

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:

Go Datadog tracing hook
1import (
2 "context"
3 "encoding/json"
4 "fmt"
5
6 "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer"
7 "github.com/launchdarkly/go-server-sdk/v7/ldhooks"
8 "github.com/launchdarkly/go-sdk-common/v3/ldreason"
9)
10
11type DatadogHook struct {
12 ldhooks.Unimplemented
13 metadata ldhooks.Metadata
14}
15
16func NewDatadogHook() DatadogHook {
17 return DatadogHook{
18 metadata: ldhooks.NewMetadata("datadog-tracing"),
19 }
20}
21
22func (h DatadogHook) Metadata() ldhooks.Metadata {
23 return h.metadata
24}
25
26func (h DatadogHook) BeforeEvaluation(
27 ctx context.Context,
28 seriesContext ldhooks.EvaluationSeriesContext,
29 data ldhooks.EvaluationSeriesData,
30) (ldhooks.EvaluationSeriesData, error) {
31 span, _ := tracer.StartSpanFromContext(ctx, "feature_flag.evaluation",
32 tracer.ResourceName(seriesContext.FlagKey()),
33 tracer.SpanType("launchdarkly"),
34 )
35
36 ldCtx := seriesContext.Context()
37 contextKeys := make(map[string]string)
38 for i := 0; i < ldCtx.IndividualContextCount(); i++ {
39 if individualCtx := ldCtx.IndividualContextByIndex(i); individualCtx.IsDefined() {
40 contextKeys[string(individualCtx.Kind())] = individualCtx.Key()
41 }
42 }
43 if ldCtx.IndividualContextCount() == 0 && ldCtx.IsDefined() {
44 contextKeys[string(ldCtx.Kind())] = ldCtx.Key()
45 }
46 contextKeysJSON, _ := json.Marshal(contextKeys)
47
48 span.SetTag("feature_flag.context.id", ldCtx.FullyQualifiedKey())
49 span.SetTag("feature_flag.contextKeys", string(contextKeysJSON))
50 span.SetTag("feature_flag.key", seriesContext.FlagKey())
51 span.SetTag("feature_flag.provider.name", "LaunchDarkly")
52
53 return ldhooks.NewEvaluationSeriesBuilder(data).Set("span", span).Build(), nil
54}
55
56func (h DatadogHook) AfterEvaluation(
57 ctx context.Context,
58 seriesContext ldhooks.EvaluationSeriesContext,
59 data ldhooks.EvaluationSeriesData,
60 detail ldreason.EvaluationDetail,
61) (ldhooks.EvaluationSeriesData, error) {
62 if spanData, ok := data.Get("span"); ok {
63 if span, ok := spanData.(*tracer.Span); ok {
64 span.SetTag("feature_flag.result.value",
65 fmt.Sprintf("%v", detail.Value.AsArbitraryValue()))
66 span.Finish()
67 }
68 }
69 return data, nil
70}

Then register the hook when you initialize the LaunchDarkly client:

Registering the hook
1import (
2 ld "github.com/launchdarkly/go-server-sdk/v7"
3 "github.com/launchdarkly/go-server-sdk/v7/ldhooks"
4)
5
6ldConfig := ld.Config{
7 Hooks: []ldhooks.Hook{NewDatadogHook()},
8}
9
10ldClient, err := ld.MakeCustomClient("YOUR_SDK_KEY", ldConfig, 5*time.Second)

When you evaluate flags, use the context-aware variation methods to pass the request context through to the hook:

Evaluating a flag with context
1value, err := ldClient.BoolVariationCtx(ctx, "my-flag-key", ldContext, false)

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:

Go tracer configuration
1import "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer"
2
3tracer.Start(
4 tracer.WithAgentURL("https://datadog.observability.app.launchdarkly.com:8126"),
5 tracer.WithService("your-service-name"),
6 tracer.WithEnv("production"),
7 tracer.WithGlobalTag("X-LaunchDarkly-Project", "YOUR_PROJECT_ID"),
8)
9defer tracer.Stop()

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

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:

  1. Open the Telemetry section and navigate to the Traces list.
  2. Search for traces from your Datadog-instrumented services.

To verify that logs are being received:

  1. Open the Telemetry section and navigate to the Logs list.
  2. Search 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.