Skip to content

feat: Add opt-in OpenTelemetry trace export#196

Open
stoopman wants to merge 2 commits into
Flagsmith:mainfrom
stoopman:feat/opentelemetry-traces
Open

feat: Add opt-in OpenTelemetry trace export#196
stoopman wants to merge 2 commits into
Flagsmith:mainfrom
stoopman:feat/opentelemetry-traces

Conversation

@stoopman

@stoopman stoopman commented Jul 6, 2026

Copy link
Copy Markdown

Summary

  • Add opt-in OpenTelemetry trace export gated on OTEL_EXPORTER_OTLP_ENDPOINT (no runtime overhead when disabled)
  • Instrument incoming HTTP requests (FastAPI), upstream environment-document polling, outbound httpx calls, and flag evaluation spans
  • Support OTLP export over HTTP (http/protobuf, default) and gRPC via OTEL_EXPORTER_OTLP_PROTOCOL
  • Inject trace_id / span_id into structlog output when an active span exists
  • Respect standard OTEL_* env vars, including OTEL_TRACING_EXCLUDED_URL_PATHS for health probes

Closes #194

Aligned with the Flagsmith OpenTelemetry docs, with gRPC protocol support as requested in the issue.

Enable OTLP trace export for HTTP requests, upstream polling, and
httpx calls when OTEL_EXPORTER_OTLP_ENDPOINT is set. Supports HTTP
and gRPC exporters, health path exclusions, and trace/log correlation.

Closes Flagsmith#194

Co-authored-by: Cursor <cursoragent@cursor.com>
@stoopman stoopman requested a review from a team as a code owner July 6, 2026 14:05
@stoopman stoopman requested review from emyller and removed request for a team July 6, 2026 14:05
@emyller emyller requested review from khvn26 and removed request for emyller July 6, 2026 14:55
@stoopman stoopman changed the title feat: add opt-in OpenTelemetry trace export Add opt-in OpenTelemetry trace export Jul 6, 2026
@stoopman stoopman changed the title Add opt-in OpenTelemetry trace export feat: Add opt-in OpenTelemetry trace export Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add OpenTelemetry support for traces (and metrics)

1 participant