fix(otel): make lite-bootstrap[fastmcp] importable (api/sdk split)#154
Merged
Conversation
is_opentelemetry_installed (find_spec("opentelemetry")) is True with only
opentelemetry-api, but the OTel instrument imports opentelemetry.sdk.* — so
any api-only environment (e.g. lite-bootstrap[fastmcp], which pulls bare
opentelemetry-api transitively) crashed `import lite_bootstrap`. Add
is_opentelemetry_sdk_installed, gate the instrument's sdk imports on it, and
require api+sdk in check_dependencies. Also warn (instead of silently skipping)
when opentelemetry_endpoint is set but the gRPC OTLP exporter is absent.
Promotes architecture/instruments.md (three-way api/sdk/exporter guard) and
clears the OTel-stack dependency-model deferral. Reproduced the crash on a
regular 3.12 interpreter; fixed and verified `[fastmcp]` now imports.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
lesnik512
added a commit
that referenced
this pull request
Jul 19, 2026
Now that the opentelemetry api/sdk split (#154) lets lite-bootstrap[fastmcp] import in an api-only environment, fastmcp/fastmcp-metrics install and smoke-pass on 3.14t. Add them to the 3.14t leg's extras; 3.13t stays excluded (cffi gates free-threading to 3.14+). Verified locally on a real 3.14t interpreter. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lite-bootstrap[fastmcp](and any environment withopentelemetry-apibut notopentelemetry-sdk) crashed onimport lite_bootstrap. Full rationale:planning/changes/2026-07-19.01-fix-otel-api-sdk-conflation.md.Reproduced on regular (GIL) CPython 3.12:
Root cause:
is_opentelemetry_installed = find_spec("opentelemetry")isTruewith onlyopentelemetry-api, but the OTel instrument importsopentelemetry.sdk.*.fastmcppulls bareopentelemetry-apitransitively. (This is the third of three incomplete-opentelemetry-stack bugs; the other two shipped in #153.)What changed
import_checker.is_opentelemetry_sdk_installed = _safe_find_spec("opentelemetry.sdk").check_dependencies()requires both api and sdk. The six api-only consumers (logging trace-injection, frameworkget_tracer_provider, faststream health-check spans) stay on the api flag.bootstrap()now warns (InstrumentDependencyMissingWarning) instead of silently skipping whenopentelemetry_endpointis set but the gRPC OTLP exporter package is absent.architecture/instruments.md(three-way api/sdk/exporter guard) and clears the OTel-stack dependency-model deferral.deferred.mdfastmcp entry updated — now imports on 3.14t (cffi still blocks 3.13t).Testing
check_dependenciesFalse; endpoint-without-exporter warns). Both provably fail on pre-fix code.just test: 211 passed, 100% coverage.just lint-ciclean (tylocal + latest).uv pip install ".[fastmcp]"+import lite_bootstrapsucceeds on regular 3.12.🤖 Generated with Claude Code