fix(deps): Require otel google-genai instrumentor >=0.7b1 for genai 2.x#6102
Closed
Jacksunwei wants to merge 1 commit into
Closed
fix(deps): Require otel google-genai instrumentor >=0.7b1 for genai 2.x#6102Jacksunwei wants to merge 1 commit into
Jacksunwei wants to merge 1 commit into
Conversation
opentelemetry-instrumentation-google-genai versions before 0.7b1 hardcode an instrumentation_dependencies() gate of "google-genai<2". Since ADK pins google-genai>=2.8,<3, those older instrumentor versions silently no-op on instrument() (logging a DependencyConflict) and never wrap Models.generate_content, disabling genai telemetry entirely. 0.7b1 widened the gate to "<3", making it compatible with genai 2.x. The existing floors (>=0.6b0 / >=0.3b0) allowed resolvers to land on a broken version; bump both the otel-gcp and test extras to >=0.7b1 so the requirement is consistent with the genai 2.8 pin and fail-safe. Change-Id: I9d7b4d32c7126c9fe0974e3f9d403e46ba85124e
copybara-service Bot
pushed a commit
that referenced
this pull request
Jun 13, 2026
Merge #6102 ## Summary Bump the floor on `opentelemetry-instrumentation-google-genai` from `>=0.6b0` / `>=0.3b0` to `>=0.7b1` in both the `otel-gcp` and `test` extras, so it is compatible with the pinned `google-genai>=2.8,<3`. ## Problem `opentelemetry-instrumentation-google-genai` versions before `0.7b1` hardcode a runtime gate in `instrumentation_dependencies()`: ```python return ["google-genai>=1.0.0,<2"] ``` This `<2` cap is **not** in the package metadata (which only declares `google-genai>=1.0.0`), so dependency resolvers happily install e.g. `0.7b0` alongside `google-genai 2.8.0`. The conflict only surfaces at runtime: `instrumentor.instrument()` detects the violation, logs a `DependencyConflict`, and **silently no-ops** — `Models.generate_content` is never wrapped, so genai telemetry is disabled entirely with no hard error. This was caught by `tests/unittests/telemetry/test_functional.py::test_instrumented_with_opentelemetry_instrumentation_google_genai`, which fails with `assert False` when a pre-`0.7b1` instrumentor is resolved (the post-`instrument()` assertion that the SDK reports as instrumented). ## Fix `0.7b1` widens the gate to `google-genai>=1.0.0,<3`, which `2.8.0` satisfies. The existing floors allowed resolvers to land on a broken version; raising both to `>=0.7b1` makes the requirement consistent with the genai 2.8 pin and fail-safe. ## Impact - Restores google-genai OTel instrumentation for users on genai 2.x with the `otel-gcp` extra. - Prevents the test suite from resolving a broken instrumentor. ## Test plan - [x] `uv.lock` already resolved to `0.7b1`; no lockfile change needed (only the specifier floor moved). - [x] `tests/unittests/telemetry/test_functional.py`: 6 passed (previously 1 failed: `test_instrumented_...`). - [x] pre-commit (`pyproject-fmt`) passes. Co-authored-by: Wei Sun (Jack) <weisun@google.com> COPYBARA_INTEGRATE_REVIEW=#6102 from google:fix/otel-genai-instrumentor-floor 8e2154f PiperOrigin-RevId: 931465846
Collaborator
|
Thank you @Jacksunwei for your contribution! 🎉 Your changes have been successfully imported and merged via Copybara in commit 2b8c80c. Closing this PR as the changes are now in the main branch. |
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
Bump the floor on
opentelemetry-instrumentation-google-genaifrom>=0.6b0/>=0.3b0to>=0.7b1in both theotel-gcpandtestextras, so it is compatible with the pinnedgoogle-genai>=2.8,<3.Problem
opentelemetry-instrumentation-google-genaiversions before0.7b1hardcode a runtime gate ininstrumentation_dependencies():This
<2cap is not in the package metadata (which only declaresgoogle-genai>=1.0.0), so dependency resolvers happily install e.g.0.7b0alongsidegoogle-genai 2.8.0. The conflict only surfaces at runtime:instrumentor.instrument()detects the violation, logs aDependencyConflict, and silently no-ops —Models.generate_contentis never wrapped, so genai telemetry is disabled entirely with no hard error.This was caught by
tests/unittests/telemetry/test_functional.py::test_instrumented_with_opentelemetry_instrumentation_google_genai, which fails withassert Falsewhen a pre-0.7b1instrumentor is resolved (the post-instrument()assertion that the SDK reports as instrumented).Fix
0.7b1widens the gate togoogle-genai>=1.0.0,<3, which2.8.0satisfies. The existing floors allowed resolvers to land on a broken version; raising both to>=0.7b1makes the requirement consistent with the genai 2.8 pin and fail-safe.Impact
otel-gcpextra.Test plan
uv.lockalready resolved to0.7b1; no lockfile change needed (only the specifier floor moved).tests/unittests/telemetry/test_functional.py: 6 passed (previously 1 failed:test_instrumented_...).pyproject-fmt) passes.