Skip to content

openai-v2: enable opentelemetry-instrumentation-genai-openai for latest experimental conventions - #5261

Open
lmolkova wants to merge 1 commit into
lmolkova/openai-v2-fix-util-genaifrom
lmolkova/openai-v2-proxy-genai-openai
Open

lmolkova wants to merge 1 commit into
lmolkova/openai-v2-fix-util-genaifrom
lmolkova/openai-v2-proxy-genai-openai

Conversation

@lmolkova

@lmolkova lmolkova commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Makes OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental useful again for existing opentelemetry-instrumentation-openai-v2 users: instead of being a no-op, it enables opentelemetry-instrumentation-genai-openai, so users who keep upgrading this package get the new instrumentation automatically.

  • Adds a dependency on opentelemetry-instrumentation-genai-openai ~= 1.3.0b0 and raises minimum OTel versions to what it requires.
  • Flag on: instrument() enables genai-openai and forwards all arguments (e.g. completion_hook).
  • Flag off: keeps genai-openai disabled. Both packages register the openai entry point and auto-instrumentation loads them in no particular order, so without this OpenAI calls would be instrumented twice.
  • Updates README and module docs for the new flag behavior (openai-v2: fix loading with util-genai 1.x, disable built-in experimental support #5260 leaves them unchanged).
  • Excludes the package from the uv workspace: genai-openai brings opentelemetry-util-genai 1.x, which conflicts with the in-repo util/opentelemetry-util-genai. It's tested via tox with PyPI dependencies.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • I am a human and not a bot
  • I have run tox -e precommit
  • I have run tox -e typecheck
  • I have run the relevant tests and linting tox environments

@github-actions github-actions Bot added the gen-ai Related to generative AI label Oct 29, 2026
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-10-29 19:10 UTC

Review the latest changes.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@lmolkova
lmolkova force-pushed the lmolkova/openai-v2-proxy-genai-openai branch from 5730b62 to 5477546 Compare October 29, 2026 17:23
@lmolkova
lmolkova added this pull request to stack #5264 October 29, 2026 17:26
@lmolkova
lmolkova force-pushed the lmolkova/openai-v2-proxy-genai-openai branch from 5477546 to e6a88c1 Compare October 29, 2026 17:28
@lmolkova
lmolkova force-pushed the lmolkova/openai-v2-proxy-genai-openai branch from e6a88c1 to 41f44e9 Compare October 29, 2026 17:34
@lmolkova
lmolkova force-pushed the lmolkova/openai-v2-proxy-genai-openai branch from 41f44e9 to 4b513e0 Compare October 29, 2026 17:42
@lmolkova
lmolkova requested a balanced review from Copilot October 29, 2026 17:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The required genai-openai dependency introduces incompatible util-genai constraints with current OpenAI Agents and Vertex AI instrumentations, blocking co-installation and upgrades even when the experimental flag is off.

2 open issues
What changed in this PR

Following #5260, this PR restores experimental-convention support for openai-v2 users by delegating to opentelemetry-instrumentation-genai-openai, while preserving legacy instrumentation when the opt-in flag is unset.

Changes:

  • Adds delegation and coexistence handling to avoid double instrumentation.
  • Adds the replacement dependency, raises minimum OpenTelemetry versions, and excludes openai-v2 from the uv workspace.
  • Updates documentation and tests for delegation, instrumentation lifecycle, and emitted telemetry.
File Description
uv.lock Removes openai-v2 workspace entries.
pyproject.toml Excludes openai-v2 from the workspace.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​tests/​test_utils.py Adds wrapper and instrumentation-scope helpers.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​tests/​test_responses.py Uses the local experimental-mode check.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​tests/​test_response_extractors.py Adds targeted pylint suppressions.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​tests/​test_latest_experimental.py Tests delegation, lifecycle, and telemetry.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​tests/​test_genai_openai_coexistence.py Tests coexistence and loading order.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​tests/​test_embeddings.py Uses the local experimental-mode check.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​tests/​test_chat_metrics.py Uses the local experimental-mode check.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​tests/​test_chat_completions.py Uses the local experimental-mode check.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​tests/​test_async_embeddings.py Uses the local experimental-mode check.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​tests/​test_async_chat_completions.py Uses the local experimental-mode check.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​tests/​requirements.oldest.txt Updates minimum test dependencies.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​tests/​requirements.latest.txt Tests against the replacement package.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​tests/​conftest.py Adds instrumentor cleanup fixtures.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​src/​opentelemetry/​instrumentation/​openai_v2/​__init__.py Implements delegation and legacy-mode blocking.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​README.rst Documents delegation, content capture, and uploads.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​pyproject.toml Adds genai-openai and raises dependency minimums.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​.changelog/​5261.changed Records minimum-version increases.
instrumentation-genai/​opentelemetry-instrumentation-openai-v2/​.changelog/​5261.added Records delegation and coexistence behavior.

Review effort: Balanced

@lmolkova
lmolkova force-pushed the lmolkova/openai-v2-proxy-genai-openai branch from 4b513e0 to 7ea481d Compare October 29, 2026 18:00
With gen_ai_latest_experimental, enable
opentelemetry-instrumentation-genai-openai (now a dependency) instead
of doing nothing. Without the flag, keep it disabled: both packages
register the 'openai' entry point, so auto-instrumentation would
otherwise instrument OpenAI twice.

genai-openai brings opentelemetry-util-genai 1.x, which conflicts with
the in-repo util-genai, so the package is excluded from the uv
workspace and tested via tox only.
@lmolkova
lmolkova force-pushed the lmolkova/openai-v2-proxy-genai-openai branch from 7ea481d to 16c1798 Compare October 29, 2026 18:59
@lmolkova
lmolkova marked this pull request as ready for review October 29, 2026 19:07
@lmolkova
lmolkova requested a review from a team as a code owner October 29, 2026 19:07

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gen-ai Related to generative AI

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants