How launchdarkly/ld-relay works
LaunchDarkly Relay Proxy accepts SDK connections, maintains upstream LaunchDarkly streams, and serves/proxies flag data and related services to many clients. Its main request path is HTTP routing through Relay to environment-specific contexts, while environment data can also arrive through automatic configuration or offline archives. It additionally supports event forwarding, persistent flag and Big Segment storage, and OTLP observability. Edges are limited to relationships shown in excerpts or documented in the README; unsampled subsystems are represented without guessed internal call chains.
Main entry points: env_context_impl.go Environment context · relay_routes.go Endpoint router · stream_provider_server_side.go Stream providers · stream_manager.go Auto-config stream
Components 22
Runtime and routing
- HTTP server
internal/application/server.go - Endpoint router
relay/relay_routes.go - Relay core
relay/relay.go
Environment lifecycle
- Environment context
internal/relayenv/env_context_impl.go - Environment factory
internal/envfactory/env_rep.go - Project router
internal/projmanager/project_router.go
Streaming and data
- Stream providers
internal/streams/stream_provider_server_side.go - Stream events
internal/streams/stream_events.go - Event forwarding
internal/events/event_publisher.go - Server SDK client
internal/sdks/client_factory.go
Enterprise features
- Auto-config stream
internal/autoconfig/stream_manager.go - Auto-config cache
internal/autoconfigcache/dynamodb_store.go - Offline archive
internal/filedata/archive_manager.go
Storage and observability
- Persistent flag store
internal/sdks/data_stores.go - Big Segments sync
internal/bigsegments/sync.go - Big Segment store
internal/bigsegments/store.go - Status metrics
internal/metrics/status_measures.go - OTLP telemetry
internal/metrics/otlp.go
Other components
- SDK clients
- LaunchDarkly services
- Redis / DynamoDB / Consul
- OTLP backend
Connections 21
- HTTP server → Endpoint router: serves routes
internal/application/server.go - SDK clients → Endpoint router: HTTP requests
relay/relay_routes.go - Endpoint router → Environment context: uses contexts
relay/relay_routes.go - Environment context → Server SDK client: creates SDK client
- Environment context → Stream providers: registers streams
internal/relayenv/env_context_impl.go - Stream providers → SDK clients: streams updates
- Server SDK client → Persistent flag store: uses data store
- Persistent flag store → Redis / DynamoDB / Consul: persists flag data
- LaunchDarkly services → Stream providers: upstream stream
- LaunchDarkly services → Event forwarding: receives events
- Event forwarding → LaunchDarkly services: forwards events
- Environment context → Big Segments sync: starts sync
internal/relayenv/env_context_impl.go - Big Segments sync → Big Segment store: writes segments
- Big Segment store → Redis / DynamoDB / Consul: persists segments
- Auto-config stream → Environment factory: parses environments
internal/autoconfig/stream_manager.go - Auto-config stream → Auto-config cache: caches updates
internal/autoconfig/stream_manager.go - Project router → Environment factory: routes environment data
internal/projmanager/project_router.go - Offline archive → Environment context: supplies offline data
- Environment context → Status metrics: registers metrics
internal/relayenv/env_context_impl.go - Status metrics → OTLP telemetry: exports measures
- OTLP telemetry → OTLP backend: exports OTLP