--- id: opentelemetry-instrumentation-google-genai version: "1.0b1" license: Apache-2.0 license_treatment: permissive maintenance: active --- # opentelemetry-instrumentation-google-genai — OpenTelemetry License: permissive · Maintenance: active · Downloads: 1.7M/mo ## What it is and what it does This package wraps the Google GenAI SDK with OpenTelemetry instrumentation to automatically capture observability data from GenAI operations. It emits trace spans for calls like generate_content and embed_content, records prompts and responses as events/logs, and aggregates metrics describing GenAI activity—all following OpenTelemetry's GenAI semantic conventions. The instrumentation works by patching the SDK's client methods, so once you call instrument() it traces all subsequent GenAI operations without requiring changes to your application code. The package is still experimental and has known defects documented in TODOS.md that block full stability. It supports Python 3.10 through 3.14 and integrates with the standard OpenTelemetry ecosystem (opentelemetry-api, opentelemetry-instrumentation, and related packages). You can optionally capture message content and GenerateContentConfig parameters via environment variables, and uninstrument clients when needed. Use it for: - Monitor GenAI API calls in production by emitting traces to your OpenTelemetry backend (e.g., Jaeger, Datadog, New Relic). - Debug GenAI application behavior by capturing prompts, responses, and tool calls as span events and logs. - Aggregate metrics on GenAI usage (request counts, latencies, token consumption) for cost and performance analysis. - Correlate GenAI operations with other application traces to understand end-to-end request flow. - Audit GenAI interactions by recording message content and configuration parameters when enabled. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Adds OpenTelemetry instrumentation to the Google GenAI SDK, automatically emitting trace spans, events, and metrics for GenAI operations like generate_content, embed_content, and interactions.create. Yes, with conditions. Install if you are already using OpenTelemetry in your application and need observability into Google GenAI SDK calls. The low install friction and permissive license make it a straightforward addition. However, be aware it is experimental with known blockers to stability—review TODOS.md before production use and expect potential API or behavior changes in future releases. ## Install pip install opentelemetry-instrumentation-google-genai uv add opentelemetry-instrumentation-google-genai poetry add opentelemetry-instrumentation-google-genai ## Installing opentelemetry-instrumentation-google-genai Before you install: Low friction install with five runtime dependencies, all from the OpenTelemetry ecosystem. Active maintenance as of 2026-08-14 with recent release history; however, marked experimental with known defects listed in TODOS.md that are blockers to stability. License in practice: Apache-2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most production environments. Quickstart: pip install opentelemetry-instrumentation-google-genai from opentelemetry.instrumentation.google_genai import GoogleGenAiSdkInstrumentor from google.genai import Client GoogleGenAiSdkInstrumentor().instrument() client = Client() response = client.models.generate_content( model="gemini-1.5-flash-002", contents="Write a short poem on OpenTelemetry." ) Requires Python 3.10 or later; assumes OpenTelemetry tracing, logging, and metrics are already configured in your application. Verify before relying: - Completeness of instrumentation coverage for all Google GenAI SDK operations beyond generate_content, embed_content, and interactions.create. - Behavior and correctness of automatic function calling span nesting under generate_content spans. - Performance impact of instrumentation on GenAI SDK operations at scale. ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 1.7M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags opentelemetry google genai instrumentation, trace genai sdk operations, google gemini telemetry, llm observability instrumentation, genai span metrics events, google genai monitoring, semantic conventions genai, observability, genai, instrumentation [View on SkillFed](https://skillfed.io/packages/opentelemetry-instrumentation-google-genai) · [View on PyPI](https://pypi.org/project/opentelemetry-instrumentation-google-genai/)