You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(google-genai): trace embeddings caches and interactions - #374
Retain traceAI-google-genai and fill its missing resource coverage; this package remains useful and should not be deleted. Existing generation tracing and the GoogleGenAIInstrumentor entry point stay unchanged.
Trace sync/async models.embed_content and cache create/get/update/delete.
Trace sync/async Interactions create/get, including both legacy InteractionsResource and current GeminiNextGenInteractions classes.
Keep Interactions spans open through consumption, error/cancellation, explicit close and context-manager exit; preserve event/response identity and parent context. Suppress nested resource wrappers to avoid duplicate spans.
Record embedding dimensions/vectors, interaction model/usage and cache metadata. Cache token counts are not generation usage. Preserve distinct streamed event fragments and sum usage over automatic-continuation completion events.
Bound content capture to 64 KiB; respect input/output/vector hiding before retaining content. Never serialize transport headers, HTTP options or whole SDK response envelopes. Telemetry extraction failures fail open with content-free warning logs.
No Live or agent instrumentation changes, native tracing replacement, new dependencies, version bump or release. PR #276 fixes generation stream part merging; this does not modify that implementation.
Reproduction and verification
The real SDK with httpx.MockTransport previously emitted only GenerateContent for generation + embedding + cache creation. With this change it emits all three expected spans. All tests below ran with outbound network denied except localhost. No vendor API or real credentials were used.
Restoring only the original instrumentor entry point while retaining the regression tests produces 15 failures at 1.8.0 and 28 at 2.34.0. Local collector tests export actual OTLP/HTTP protobuf and inspect the wire for span shape, content hiding, vectors and transport-secret exclusion. Additional cases cover parentage, suppress/uninstrument, SDK errors, cancellation, early close, error events, nested calls, bounded buffering and telemetry extraction failures.
A dedicated wheel-based, network-denied CI matrix covers Python 3.10–3.13 at SDK floor, lock, legacy and current versions. New modules/tests pass Ruff check and format. The entry-point file has the same eight pre-existing Ruff findings as the base; no unrelated formatting sweep is included.
Documentation and rollout
README states exact coverage and lifecycle/privacy behavior. The site guide is held until the corrected package is available on the registry; no docs PR claims unreleased support. Other SDK resources (including image generation and Live) are not covered by this package. Close streams when stopping early; abandoned, unclosed streams are not guaranteed to export.
E2E coverage
Not applicable (no product e2e/ harness); real SDK request/response/SSE parsing and localhost OTLP export are covered by offline tests.
Summary
Retain
traceAI-google-genaiand fill its missing resource coverage; this package remains useful and should not be deleted. Existing generation tracing and theGoogleGenAIInstrumentorentry point stay unchanged.models.embed_contentand cache create/get/update/delete.InteractionsResourceand currentGeminiNextGenInteractionsclasses.No Live or agent instrumentation changes, native tracing replacement, new dependencies, version bump or release. PR #276 fixes generation stream part merging; this does not modify that implementation.
Reproduction and verification
The real SDK with
httpx.MockTransportpreviously emitted onlyGenerateContentfor generation + embedding + cache creation. With this change it emits all three expected spans. All tests below ran with outbound network denied except localhost. No vendor API or real credentials were used.Restoring only the original instrumentor entry point while retaining the regression tests produces 15 failures at 1.8.0 and 28 at 2.34.0. Local collector tests export actual OTLP/HTTP protobuf and inspect the wire for span shape, content hiding, vectors and transport-secret exclusion. Additional cases cover parentage, suppress/uninstrument, SDK errors, cancellation, early close, error events, nested calls, bounded buffering and telemetry extraction failures.
Re-run after installation:
A dedicated wheel-based, network-denied CI matrix covers Python 3.10–3.13 at SDK floor, lock, legacy and current versions. New modules/tests pass Ruff check and format. The entry-point file has the same eight pre-existing Ruff findings as the base; no unrelated formatting sweep is included.
Documentation and rollout
README states exact coverage and lifecycle/privacy behavior. The site guide is held until the corrected package is available on the registry; no docs PR claims unreleased support. Other SDK resources (including image generation and Live) are not covered by this package. Close streams when stopping early; abandoned, unclosed streams are not guaranteed to export.
E2E coverage
Not applicable (no product e2e/ harness); real SDK request/response/SSE parsing and localhost OTLP export are covered by offline tests.
Generated with Claude Code