feat(util-genai): refactor and make API smaller and more user-friendly#4391
Merged
xrmx merged 17 commits intoopen-telemetry:mainfrom Apr 15, 2026
Merged
feat(util-genai): refactor and make API smaller and more user-friendly#4391xrmx merged 17 commits intoopen-telemetry:mainfrom
xrmx merged 17 commits intoopen-telemetry:mainfrom
Conversation
720ba87 to
23e777f
Compare
lmolkova
commented
Apr 3, 2026
lmolkova
commented
Apr 3, 2026
lmolkova
commented
Apr 3, 2026
0fc33e7 to
b8e7e4e
Compare
MikeGoldsmith
approved these changes
Apr 3, 2026
Member
MikeGoldsmith
left a comment
There was a problem hiding this comment.
Looks good to me. I've left one small suggestion for separating invocation types file, but not blocking.
I see you have a few TODOs you'd like to probably resolve before merging too.
DylanRussell
reviewed
Apr 3, 2026
Member
Author
|
@MikeGoldsmith and @DylanRussell thanks for the review! The todos are the existing ones - it's easy to a address them but I didn't want to include any new features into this pure refactoring PR. |
DylanRussell
approved these changes
Apr 3, 2026
Kludex
reviewed
Apr 4, 2026
Kludex
reviewed
Apr 4, 2026
392ae45 to
39ffa9d
Compare
keith-decker
reviewed
Apr 6, 2026
keith-decker
approved these changes
Apr 6, 2026
Member
Author
|
/cc @Cirilla-zmh |
MikeGoldsmith
approved these changes
Apr 8, 2026
Member
MikeGoldsmith
left a comment
There was a problem hiding this comment.
Still looks good but has some conflicts that need resolving first.
4d4e31d to
320bfd0
Compare
eternalcuriouslearner
approved these changes
Apr 15, 2026
xrmx
approved these changes
Apr 15, 2026
shuningc
pushed a commit
to shuningc/opentelemetry-python-contrib
that referenced
this pull request
Apr 16, 2026
open-telemetry#4391) * Refactor public API on GenAI utils * more lint * review feedback * update tests to use named params * address some of the comments * up * fix failing checks and clean up imports * lint * lint * fix lint * replace @deprecated with docstring info to avoid warnings for users * up * common code for context manager
aabmass
pushed a commit
that referenced
this pull request
Apr 16, 2026
* linting fix * Updating changelog * Updating changelog PR number * Removing embedding events emission * Refatoring and adding input token metric for Embedding invocation * Merging and removing unused import * build(deps): bump aiohttp from 3.13.3 to 3.13.4 (#4386) --- updated-dependencies: - dependency-name: aiohttp dependency-version: 3.13.4 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Revert "Build list of required jobs in generate-workflow (#4326)" (#4413) This reverts commit 22879d6. Now that we have just one job to check we don't need to build the list anymore. * Drop Python 3.9 support (#4412) * Drop Python 3.9 support Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com> * generate-workflows Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com> * fixes Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com> * remove extra reference to pypy310 Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com> * changelog Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com> * fix flask tests Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com> * fix google-genai tests Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com> * fix google-genai tests Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com> * fix Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com> * remove unused _ensure_gzip_single_response Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com> --------- Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com> Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com> * Add AGENTS.md with project structure and commands (#4233) * Add CLAUDE.md with project structure and commands * Add AGENTS.md symlink to CLAUDE.md * Move guidance to AGENTS.md and address review feedback - Move main content from CLAUDE.md to AGENTS.md so all AI agents (not only Claude) pick up the guidance; CLAUDE.md now just references it via `@AGENTS.md`. - Add general rules, PR scoping, and `Assisted-by:` commit trailer guidance (inspired by the Collector's AGENTS.md). - Clarify that only instrumentation packages live under `src/opentelemetry/instrumentation/{name}/`; other package types use their own namespace. --------- Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com> * scripts: drop update_sha (#4430) It's buggy and unused. * Fix pylint false positives for ThreadPoolExecutor (#4244) * Bump pylint to 4.0.5 to fix Python 3.14 concurrent.futures false positives * Fix too-many-positional-arguments pylint failures - Add max-positional-arguments=10, Add pylint: disable=too-many-positional-arguments to functions that legitimately exceed the limit * Bump max-positional-arguments to 12 and remove unnecessary disable comments * Address review comments: fix CHANGELOG, remove stale pylintrc comment, add openai-agents disable * Fix formatting: restore blank line in CHANGELOG and remove extra blank line in .pylintrc * Update processor.py * Update test_botocore_bedrock.py --------- Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com> * feat(util-genai): refactor and make API smaller and more user-friendly (#4391) * Refactor public API on GenAI utils * more lint * review feedback * update tests to use named params * address some of the comments * up * fix failing checks and clean up imports * lint * lint * fix lint * replace @deprecated with docstring info to avoid warnings for users * up * common code for context manager * Adding metrics call for Embedding type after refactoring * Updating metrics tests with embedding * Adding fix for markdown-link-check --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com> Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com> Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com> Co-authored-by: Sri Kaaviya <107148069+srikaaviya@users.noreply.github.com> Co-authored-by: Liudmila Molkova <neskazu@gmail.com>
11 tasks
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.
Replaces the
handler.start_llm(invocation) / handler.stop_llm(invocation)pattern with factory methods that construct and start spans in one call, and moves lifecycle ownership onto the invocation object. Existing code continues to work —LLMInvocation,stop_llm, andfail_llmare kept with@deprecatedmarkers.Before
After