Skip to content

GenAI Utils | Embedding Type and Span Creation#4219

Merged
lzchen merged 51 commits into
open-telemetry:mainfrom
shuningc:adding-embedding-type
Mar 26, 2026
Merged

GenAI Utils | Embedding Type and Span Creation#4219
lzchen merged 51 commits into
open-telemetry:mainfrom
shuningc:adding-embedding-type

Conversation

@shuningc
Copy link
Copy Markdown
Contributor

@shuningc shuningc commented Feb 19, 2026

Description

This PR adds initial embedding lifecycle coverage, to add metrics in the next PR.

Type of change

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

How Has This Been Tested?

Ran from repo root with local package path:
PYTHONPATH=util/opentelemetry-util-genai/src pytest -q util/opentelemetry-util-genai/tests/test_utils.py
PYTHONPATH=util/opentelemetry-util-genai/src pytest -q util/opentelemetry-util-genai/tests/test_handler_metrics.py
Results:
[test_utils.py]: 23 passed

Does This PR Require a Core Repo Change?

  • No.

Checklist:

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

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@shuningc shuningc requested a review from a team as a code owner February 19, 2026 17:08
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Feb 19, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

@aabmass aabmass marked this pull request as draft February 19, 2026 17:19
Comment thread util/opentelemetry-util-genai/CHANGELOG.md Outdated
Comment thread util/opentelemetry-util-genai/README.rst Outdated
Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/span_utils.py Outdated
Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/types.py Outdated
Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/types.py Outdated
@shuningc shuningc changed the title [WIP] GenAI Utils | Embedding Type and Span Creation GenAI Utils | Embedding Type and Span Creation Feb 23, 2026
@shuningc shuningc marked this pull request as ready for review February 23, 2026 16:04
Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/types.py Outdated
Comment thread util/opentelemetry-util-genai/CHANGELOG.md
Comment thread util/opentelemetry-util-genai/pyproject.toml Outdated
Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/types.py
Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/types.py Outdated
Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/types.py Outdated
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Copy link
Copy Markdown
Member

@lmolkova lmolkova left a comment

Choose a reason for hiding this comment

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

tried it with with OpenAI instrumentation and left a couple of comments.

Looks good otherwise!

Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/handler.py Outdated
Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/types.py
xrmx and others added 3 commits March 5, 2026 06:28
* gen-requirements: stay with virtualenv < 21

No idea what's going on but looks like hatch / hatchling has issues with
latest virtualenv 21:

Environment `hatch-build` is incompatible: module 'virtualenv.discovery.builtin' has no attribute 'propose_interpreters'

* Update gen-requirements.txt

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
…lemetry#4246)

* fix(threading): attribute error when run is called w/o start

* update changelog

* don't initialize context on run, fix tests

* address styling comments

* remove no-op context attachment
…emetry#4253)

* [google-genai] Test instrumentation on google-genai v1.63.0

* Add package version upper bound

* bump latest version for python 3.9

* fix README

* bump google-auth version for python 3.9

* add package upper limit to pyproject.toml

* [google-genai] Test instrumentation on google-genai v1.64.0

* fix upper case method in cassette not matching lower case one generated by aiohttp

* fix async calls hanging in vcrpy

* Remove package upper limit

* fix import error in python 3.9

* fix google-genai module lower bound

* Add link to vcr issue

* Add comment about request method

* Fix lint errors

* Fix spellcheck

---------

Co-authored-by: Aaron Abbott <aaronabbott@google.com>
Copy link
Copy Markdown
Member

@lmolkova lmolkova left a comment

Choose a reason for hiding this comment

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

Let's make sure we don't throw in instrumentation code and also, can we avoid having start_{type}, end_{type}, fail_{type} - we can just have start, stop, fail for all of them

Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/handler.py Outdated
Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/handler.py Outdated
Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/handler.py Outdated
Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/handler.py Outdated
Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/handler.py Outdated
Comment thread util/opentelemetry-util-genai/src/opentelemetry/util/genai/handler.py Outdated
@shuningc
Copy link
Copy Markdown
Contributor Author

Let's make sure we don't throw in instrumentation code and also, can we avoid having start_{type}, end_{type}, fail_{type} - we can just have start, stop, fail for all of them

Langchain, anthropic and openai_v2 instrumentation all have called the start_llm, fail_llm and stop_llm methods. So I prefer to keep these for now and same for embedding type right now. If we want to remove them all later we can create a separate ticket.

Copy link
Copy Markdown
Member

@lmolkova lmolkova left a comment

Choose a reason for hiding this comment

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

LGTM with a caveat around removing stop|fail_embedding methods

Comment thread util/opentelemetry-util-genai/CHANGELOG.md Outdated
@lzchen lzchen merged commit 195bcdb into open-telemetry:main Mar 26, 2026
860 checks passed
@github-project-automation github-project-automation Bot moved this from Approved PRs that need fixes to Done in Python PR digest Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.