Skip to content

fix(AIC-3596): name the [otel] extra in the missing-OTel warning - #186

Merged
jeffdupont merged 1 commit into
mainfrom
jdupont/aic-3596-otel-install-hint
Oct 21, 2026
Merged

jeffdupont merged 1 commit into
mainfrom
jdupont/aic-3596-otel-install-hint

Conversation

@jeffdupont

@jeffdupont jeffdupont commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes AIC-3596.

Why

When the OpenTelemetry packages are missing, init_client() logs a warning telling users to run pip install opentelemetry-sdk. That isn't enough. Telemetry also needs opentelemetry-exporter-otlp-proto-http, so someone who follows the hint gets the same warning again. The READMEs already give the right command, pip install "launchdarkly-ai-server[otel]", which installs both packages. This PR makes the warning match. The JS SDK is getting the same fix: its warning will point at @launchdarkly/ai-otel.

Fix

  • packages/client/src/launchdarkly_ai_server/lifecycle.py: the warning now says Run `pip install "launchdarkly-ai-server[otel]"` to enable telemetry.
  • packages/client/tests/test_lifecycle.py: test_emits_warning_once used to replace _setup_telemetry with a stub that logged its own text, so it never checked the real message. It now forces the real import to fail (sys.modules["opentelemetry.sdk.trace"] = None) and checks that exactly one warning appears and that it contains the [otel] install command.

Testing

  • Before the fix, the new test failed: assert 'pip install "launchdarkly-ai-server[otel]"' in 'OpenTelemetry packages not installed. Run pip install opentelemetry-sdk to enable telemetry.'
  • make test: 2544 passed, 14 skipped. make typecheck: no issues in 75 source files. make lint: all checks passed.

Related: launchdarkly/js-ai-sdk#144

🤖 Generated with Claude Code


Note

Overview
When OpenTelemetry isn’t installed, init_client now tells users to run pip install "launchdarkly-ai-server[otel]" instead of only opentelemetry-sdk, so the hint matches the extra that pulls in the OTLP exporter as well.

test_emits_warning_once no longer stubs _setup_telemetry with fake log text; it forces the real OTel import to fail and asserts a single warning that includes the [otel] install command.

Reviewed by Cursor Bugbot for commit 3c06259. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jeffdupont
jeffdupont merged commit 90ce7bf into main Oct 21, 2026
8 checks passed
@jeffdupont
jeffdupont deleted the jdupont/aic-3596-otel-install-hint branch October 21, 2026 14:05
@github-actions github-actions Bot mentioned this pull request Oct 21, 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.

2 participants