Skip to content

feat(sdk): add otel=True instrumentation flag for Python SDK#117

Merged
zeevdr merged 1 commit into
mainfrom
feat/otel-instrumentation
May 31, 2026
Merged

feat(sdk): add otel=True instrumentation flag for Python SDK#117
zeevdr merged 1 commit into
mainfrom
feat/otel-instrumentation

Conversation

@zeevdr
Copy link
Copy Markdown
Member

@zeevdr zeevdr commented May 31, 2026

Summary

  • Adds opt-in OpenTelemetry gRPC instrumentation to the Python SDK so users can see get/set/watch operations in their application traces without paying any dependency cost when OTel is not in use.
  • A new _otel.py module lazy-imports opentelemetry-instrumentation-grpc, so importing the SDK does not pull in OTel unless otel=True is passed.
  • The OTel interceptor is wired outermost on the channel, wrapping both user-supplied interceptors and the SDK's internal auth interceptor.

Test plan

  • make test — 298 passed, 100% coverage (10 new unit tests in test_otel.py)
  • make lint — clean (ruff check + format)
  • test_otel.py::TestMakeSyncInterceptor — verifies lazy import, helpful error on missing package
  • test_otel.py::TestMakeAioInterceptors — same for async
  • test_otel.py::TestSyncClientOtel — verifies interceptor ordering (OTel → user → auth)
  • test_otel.py::TestAsyncClientOtel — same for async client

Closes #23

Adds opt-in OpenTelemetry gRPC instrumentation to ConfigClient and
AsyncConfigClient. When otel=True, an OTel interceptor is wired outermost
on the channel so get/set/watch RPCs appear in application traces.

- New _otel.py module with lazy imports (no dep cost when otel=False)
- otel optional extra: pip install opendecree[otel]
- Works for sync client, async client, and watchers (inherit channel)
- OTel interceptor is outermost (wraps user interceptors + auth)
- 100% test coverage; 10 new unit tests

Co-Authored-By: Claude <noreply@anthropic.com>

Closes #23
@zeevdr zeevdr added size: S Quick win — a few hours or less priority: P1 Current milestone work labels May 31, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@zeevdr zeevdr merged commit a28513e into main May 31, 2026
15 checks passed
@zeevdr zeevdr deleted the feat/otel-instrumentation branch May 31, 2026 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: P1 Current milestone work size: S Quick win — a few hours or less

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate CodeQL to advanced setup

1 participant