Skip to content

feat(otel): add OTLP/gRPC export support#247

Merged
khvn26 merged 4 commits into
Flagsmith:mainfrom
stoopman:feat/otlp-grpc-export
Jul 14, 2026
Merged

feat(otel): add OTLP/gRPC export support#247
khvn26 merged 4 commits into
Flagsmith:mainfrom
stoopman:feat/otlp-grpc-export

Conversation

@stoopman

@stoopman stoopman commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Honour OTEL_EXPORTER_OTLP_PROTOCOL when configuring OTLP trace and log export
  • Add opentelemetry-exporter-otlp-proto-grpc to the otel extra and select gRPC exporters when OTEL_EXPORTER_OTLP_PROTOCOL=grpc
  • Resolve exporter endpoints per protocol (HTTP keeps /v1/traces and /v1/logs; gRPC uses the base collector URL)

Fixes Flagsmith/flagsmith#7812

Honour OTEL_EXPORTER_OTLP_PROTOCOL so traces and logs can be exported
over gRPC as well as OTLP/HTTP, fixing self-hosted deployments that
point at gRPC-only collectors.

Refs Flagsmith/flagsmith#7812

Co-authored-by: Cursor <cursoragent@cursor.com>
@stoopman stoopman requested a review from a team as a code owner July 8, 2026 11:01
@stoopman stoopman requested review from emyller and removed request for a team July 8, 2026 11:01
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: dc37c6f1-1640-44bd-88c8-c94bc2bbaf90

📥 Commits

Reviewing files that changed from the base of the PR and between 7bc5dcc and d778510.

📒 Files selected for processing (6)
  • README.md
  • src/common/core/constants.py
  • src/common/core/main.py
  • src/common/core/otel.py
  • src/common/core/types.py
  • tests/unit/common/core/test_otel.py

📝 Walkthrough

Walkthrough

Adds OTLP gRPC transport support alongside the existing HTTP transport in OpenTelemetry setup. Endpoint resolution and provider construction now use the configured protocol, with ensure_cli_env passing protocol-specific endpoints to log and trace providers. The gRPC exporter dependency, unit tests, and README OpenTelemetry documentation are updated.

Estimated code review effort: 3 (Moderate) | ~25 minutes


Comment @coderabbitai help to get the list of available commands.

Co-authored-by: Cursor <cursoragent@cursor.com>

@khvn26 khvn26 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing to Flagsmith's OTel support @stoopman, very happy to see people using it!

The PR mostly LGTM, with a couple questions from my side.

Also, it seems there are typing errors to resolve still.

Comment thread src/common/core/otel.py Outdated
Comment thread src/common/core/otel.py Outdated
Comment thread src/common/core/otel.py Outdated
Comment thread src/common/core/otel.py Outdated
@stoopman

Copy link
Copy Markdown
Contributor Author

@khvn26 Thanks for your review, I've pushed some updates which handle your requested changes

@stoopman stoopman requested a review from khvn26 July 13, 2026 12:09
khvn26
khvn26 previously approved these changes Jul 13, 2026

@khvn26 khvn26 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with two nitpicks — feel free to address them if you like.

Comment thread src/common/core/constants.py Outdated
Comment thread src/common/core/otel.py Outdated
@codecov-commenter

codecov-commenter commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.58%. Comparing base (83e5d1a) to head (d778510).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #247      +/-   ##
==========================================
+ Coverage   97.56%   97.58%   +0.02%     
==========================================
  Files         108      109       +1     
  Lines        4757     4802      +45     
==========================================
+ Hits         4641     4686      +45     
  Misses        116      116              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stoopman

Copy link
Copy Markdown
Contributor Author

LGTM with two nitpicks — feel free to address them if you like.

@khvn26 Thanks! I made some minor adjustments

@khvn26 khvn26 merged commit 45b08b4 into Flagsmith:main Jul 14, 2026
4 checks passed
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 gRPC support for OpenTelemetry OTLP export

3 participants