Self-hosting an OpenTelemetry Collector
Self-hosting an OpenTelemetry Collector
Overview
This topic explains how to set up an OpenTelemetry Collector to forward telemetry data to LaunchDarkly. This is useful if you want to:
- Buffer and retry telemetry data closer to your application, reducing data loss during network interruptions
- Filter or transform data before it leaves your network
- Consolidate telemetry from multiple services through a single egress point
- Reduce direct internet dependencies from your application pods
- Dual-export data to LaunchDarkly and another observability backend simultaneously
An OpenTelemetry Collector does not replace the Relay Proxy
The OpenTelemetry Collector handles telemetry data (traces, logs, metrics) only. It does not proxy flag evaluations or SDK configuration. If you need to proxy flag evaluation traffic, use the Relay Proxy instead. You can use both a Relay Proxy and an OpenTelemetry Collector together.
Prerequisites
To implement an OpenTelemetry Collector you require:
- An OpenTelemetry Collector binary or container image. Use the OpenTelemetry Collector Contrib distribution if you need additional exporters or processors.
- Your LaunchDarkly SDK key, available from your project’s Settings page.
Collector configuration
Create a file named otel-collector-config.yaml with the following configuration. This sets up the Collector to receive OTLP data from your SDKs and forward it to LaunchDarkly:
Place memory_limiter before batch
The memory_limiter processor must appear before batch in the processors list. This ensures that the Collector sheds load before buffering more data, and prevents out-of-memory crashes.
Running the Collector
Docker
Docker Compose
Kubernetes
Deploy the Collector as a Deployment or DaemonSet. The OpenTelemetry Operator for Kubernetes simplifies this.
Configuring the SDK to use the Collector
Point your LaunchDarkly observability SDK at the Collector instead of the default LaunchDarkly endpoint. Set the OTLP endpoint to your Collector’s address.
The public endpoint cannot be proxied through the Collector
The Collector only handles OTLP telemetry data. The SDK still communicates directly with pub.observability.app.launchdarkly.com to fetch sampling configuration. Make sure your application can reach this endpoint.
You can also set the endpoint using the OTEL_EXPORTER_OTLP_ENDPOINT environment variable for SDKs that support it (Node.js, Python, .NET, Ruby).
Dual-export to LaunchDarkly and another backend
A common use case is exporting telemetry to both LaunchDarkly and another observability provider. Add a second exporter and include it in your pipelines:
Filtering sensitive data
You can use the Collector’s filter and attributes processors to remove sensitive data before it leaves your network:
To learn more about available processors, read the OpenTelemetry Collector documentation.