fix(otel): fall back user.id onto span extras when EVENT_ONLY key is missing#6362
Open
DmitriiK wants to merge 1 commit into
Open
fix(otel): fall back user.id onto span extras when EVENT_ONLY key is missing#6362DmitriiK wants to merge 1 commit into
DmitriiK wants to merge 1 commit into
Conversation
…missing opentelemetry-instrumentation-google-genai (through 1.0b0) does not export GENERATE_CONTENT_EVENT_ONLY_EXTRA_ATTRIBUTES_CONTEXT_KEY, so ADK silently dropped session user.id. Merge log-only attributes into the existing span extras context key as a fallback. Fixes google#6361
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Collaborator
|
Hi @DmitriiK , Thank you for your contribution! It appears you haven't yet signed the Contributor License Agreement (CLA). Please visit https://cla.developers.google.com/ to complete the signing process. Once the CLA is signed, we'll be able to proceed with the review of your PR. Thank you! |
Author
|
@rohityan |
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.
Summary
GENERATE_CONTENT_EVENT_ONLY_EXTRA_ATTRIBUTES_CONTEXT_KEYcannot be imported fromopentelemetry-instrumentation-google-genai, mergelog_only_extra_attributes(includinguser.id) intoGENERATE_CONTENT_EXTRA_ATTRIBUTES_CONTEXT_KEYinstead of silently dropping them.Context
opentelemetry-instrumentation-google-genaithrough 1.0b0 only exports the span extras key. ADK’sexcept (ImportError, AttributeError): passmeantsession.user_idnever reached Cloud Trace / GenAI spans on the instrumentor path (Vertex Agent Engine).Trade-off:
user.idlands ongenerate_contentspans when the event-only channel is unavailable (slightly broader than “log-only”), which is preferable to dropping identity entirely until instrumentation ships the EVENT_ONLY key (opentelemetry-python-genai#24).Test plan
generate_contentspans includeuser.idfromsession.user_iduser.id=<value>ongenerate_contentspansMade with Cursor