Update google genai instrumentation to work with latest semantic convention, allow for uploading content.#3772
Merged
aabmass merged 40 commits intoopen-telemetry:mainfrom Oct 13, 2025
Conversation
|
|
aabmass
reviewed
Sep 23, 2025
...trumentation-google-genai/src/opentelemetry/instrumentation/google_genai/generate_content.py
Outdated
Show resolved
Hide resolved
...trumentation-google-genai/src/opentelemetry/instrumentation/google_genai/generate_content.py
Outdated
Show resolved
Hide resolved
...trumentation-google-genai/src/opentelemetry/instrumentation/google_genai/generate_content.py
Outdated
Show resolved
Hide resolved
...trumentation-google-genai/src/opentelemetry/instrumentation/google_genai/generate_content.py
Outdated
Show resolved
Hide resolved
...trumentation-google-genai/src/opentelemetry/instrumentation/google_genai/generate_content.py
Outdated
Show resolved
Hide resolved
...trumentation-google-genai/src/opentelemetry/instrumentation/google_genai/generate_content.py
Outdated
Show resolved
Hide resolved
e76d888 to
d0d6f1a
Compare
Co-authored-by: Aaron Abbott <aaronabbott@google.com>
d0d6f1a to
ee911f5
Compare
5d0572a to
8583327
Compare
DylanRussell
reviewed
Oct 1, 2025
...-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/instrumentor.py
Outdated
Show resolved
Hide resolved
DylanRussell
reviewed
Oct 6, 2025
instrumentation-genai/opentelemetry-instrumentation-google-genai/tests/requirements.oldest.txt
Show resolved
Hide resolved
…y-python-contrib into genai-instrumentation-semconv
aabmass
approved these changes
Oct 9, 2025
Member
aabmass
left a comment
There was a problem hiding this comment.
Thank you, LGTM! Will merge once Dylan has finished reviewing/approved too.
...trumentation-google-genai/src/opentelemetry/instrumentation/google_genai/generate_content.py
Outdated
Show resolved
Hide resolved
...trumentation-google-genai/src/opentelemetry/instrumentation/google_genai/generate_content.py
Outdated
Show resolved
Hide resolved
...entation-genai/opentelemetry-instrumentation-google-genai/tests/generate_content/test_e2e.py
Show resolved
Hide resolved
...rate_content/cassettes/test_streaming[excludecontent-gemini-2.5-flash-vertexaiapi-sync].yaml
Outdated
Show resolved
Hide resolved
...ate_content/cassettes/test_streaming[excludecontent-gemini-2.5-flash-vertexaiapi-async].yaml
Outdated
Show resolved
Hide resolved
util/opentelemetry-util-genai/src/opentelemetry/util/genai/types.py
Outdated
Show resolved
Hide resolved
DylanRussell
reviewed
Oct 9, 2025
...ation-genai/opentelemetry-instrumentation-google-genai/tests/utils/test_tool_call_wrapper.py
Show resolved
Hide resolved
...metry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/message.py
Show resolved
Hide resolved
...trumentation-google-genai/src/opentelemetry/instrumentation/google_genai/generate_content.py
Outdated
Show resolved
Hide resolved
...rate_content/cassettes/test_streaming[excludecontent-gemini-2.5-flash-vertexaiapi-sync].yaml
Outdated
Show resolved
Hide resolved
DylanRussell
approved these changes
Oct 10, 2025
…y-python-contrib into genai-instrumentation-semconv
...metry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/message.py
Show resolved
Hide resolved
...aming[logcontent-gemini-2.5-flash-vertexaiapi-sync-enable_completion_hook-experimental].yaml
Show resolved
Hide resolved
1 task
sightseeker
added a commit
to sightseeker/opentelemetry-python-contrib
that referenced
this pull request
Mar 11, 2026
…ention, allow for uploading content. (open-telemetry#3772) * Update google genai instrumentation to latest semantic convention. Co-authored-by: Aaron Abbott <aaronabbott@google.com> * fix: log roles as str, event attrs as objects. * fix: proper event name * refactor: remove unused message models. * refactor: use OTel imported semconv attributes. * refactor: Inject upload_hook in Instrumentor. * refactor: rename upload hook to completion hook. * test: add tests for non streaming case and tool_call_wrapper. * test: add tool call instrumentation tests and nonstreaming recording in spans test. * fix: remove print * feature: add blobpart and filepart to message handling * fix: encode bytes as base64 when dumping to json string. * fix: always call completion hook, independently of recording settings. * test: update requirements for instrumentation-google-genai oldest env * test: bump google-genai lib version in -oldest test env. * test: fix event recording test. * Update FakeCredentials * Fix tests * fix lint issues * fix: aggregate streaming messages into one event. * fix: remove gen_ai.system from latest sem_conv * refactor: import encoder from utils-genai * build: update deps versions. * refactor: deduplicate creating attributes, use gen_ai_json_dumps * refactor: move blobpart and filedatapart to instrumentation-google-genai package. * test: add comment for headers. * test: fix span attributes formatting. * fix: lint * fix: use LogRecord instead of Event. * docs: update changelog * build: update uv.lock * test: disable lint * build: unpin opentelemetry-util-genai version * test: add e2e completion_hook test --------- Co-authored-by: Aaron Abbott <aaronabbott@google.com> Co-authored-by: Dylan Russell <dylanrus@gmail.com> Co-authored-by: DylanRussell <DylanRussell@users.noreply.github.com>
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.
Description
Accomodation of semantic conventions changes made in open-telemetry/semantic-conventions#2179.
Also, when logging the completion details, the upload hook is called, so if user has configured
OTEL_INSTRUMENTATION_GENAI_UPLOAD_BASE_PATHandOTEL_INSTRUMENTATION_GENAI_UPLOAD_HOOKenv vars, completion details will also be logged as refs (if appropriate capture content env var is set).Type of change
How Has This Been Tested?
Unit tests, manual tests.
Does This PR Require a Core Repo Change?
No
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.