Skip to content

Commit 2b8c80c

Browse files
Jacksunweicopybara-github
authored andcommitted
fix(deps): Require otel google-genai instrumentor >=0.7b1 for genai 2.x
Merge google#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=google#6102 from google:fix/otel-genai-instrumentor-floor 8e2154f PiperOrigin-RevId: 931465846
1 parent fa82929 commit 2b8c80c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ optional-dependencies.mcp = [
184184
"mcp>=1.24,<2",
185185
]
186186
optional-dependencies.otel-gcp = [
187-
"opentelemetry-instrumentation-google-genai>=0.6b0,<1",
187+
"opentelemetry-instrumentation-google-genai>=0.7b1,<1",
188188
"opentelemetry-instrumentation-grpc>=0.43b0,<1",
189189
"opentelemetry-instrumentation-httpx>=0.54b0,<1",
190190
]
@@ -226,7 +226,7 @@ optional-dependencies.test = [
226226
"opentelemetry-exporter-gcp-monitoring>=1.9.0a0,<2",
227227
"opentelemetry-exporter-gcp-trace>=1.9,<2",
228228
"opentelemetry-exporter-otlp-proto-http>=1.36",
229-
"opentelemetry-instrumentation-google-genai>=0.3b0,<1",
229+
"opentelemetry-instrumentation-google-genai>=0.7b1,<1",
230230
"opentelemetry-resourcedetector-gcp>=1.9.0a0,<2",
231231
"pandas>=2.2.3",
232232
"protobuf>=6",

0 commit comments

Comments
 (0)