feat(google-genai): add util-backed 2.x instrumentation#250
Draft
sipercai wants to merge 1 commit into
Draft
Conversation
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
This PR adds LoongSuite-native instrumentation for the Google Gen AI Python SDK, backed by
opentelemetry-util-genai.It instruments the Google Gen AI 2.x synchronous and asynchronous APIs for:
generate_contentgenerate_content_streamembed_contentThe implementation records LLM and embedding spans, request/response model metadata, response IDs, finish reasons, token usage, captured messages, streaming TTFT, embedding dimensions, errors, and GenAI client metrics.
The package includes opt-in live tests and sanitized VCR coverage. Public CI replays cassettes with
--vcr-record=noneand does not require provider credentials.Fixes # (N/A)
Type of change
How Has This Been Tested?
PRE_COMMIT_HOME="$(mktemp -d)" tox -e precommittox -e generate-workflowstox -c tox-loongsuite.ini -e py312-test-loongsuite-instrumentation-google-genai-oldest,py312-test-loongsuite-instrumentation-google-genai-latestDoes This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.
Validation Evidence
Spec and Scope
Local Checks
python "$PIPELINE_SKILL_DIR/scripts/check_loongsuite_pr_readiness.py" --repo .PRE_COMMIT_HOME="$(mktemp -d)" tox -e precommittox -c tox-loongsuite.ini -e py312-test-loongsuite-instrumentation-google-genai-oldest,py312-test-loongsuite-instrumentation-google-genai-latesttox -e generate-workflows.github/scripts/detect_loongsuite_changes.pywith the PR file listfull=false; package set contains onlyloongsuite-instrumentation-google-genai.Real E2E Matrix
generate_contentLLM span with response and token attributes.ERRORwitherror.type=ClientError.Additional live coverage included direct multi-turn generation, forced function calling, synchronous/asynchronous embeddings, and asynchronous non-streaming generation.
Telemetry and Weaver
SPAN_ONLYdemoNO_CONTENTbehavior.weaver registry live-check -r <registry>/model --advice-profile loongsuite-genai ...tool_call_indexis defined twice. The 12-span JSON sample is available for rerun after the registry is fixed.CI