--- id: opentelemetry-instrumentation-google-generativeai version: "0.62.3" license: Apache-2.0 license_treatment: permissive maintenance: active --- # opentelemetry-instrumentation-google-generativeai — OpenTelemetry Google Generative AI instrumentation License: permissive · Maintenance: active · Downloads: 3.1M/mo ## What it is and what it does This package is an OpenTelemetry instrumentation layer that automatically captures telemetry from calls to the Google Generative AI library. When installed and initialized, it intercepts prompts, completions, and embeddings and exports them as OpenTelemetry spans, allowing you to observe and debug LLM application behavior through standard observability tools. By default, it logs the full content of prompts and completions to span attributes for visibility into model inputs and outputs. This can be disabled via the TRACELOOP_TRACE_CONTENT environment variable if you need to protect sensitive user data or reduce trace size. The package depends on the core OpenTelemetry API and instrumentation framework, plus semantic convention libraries for AI workloads. Use it for: - Debug Gemini API calls by inspecting prompts and completions in your observability backend - Monitor token usage and latency of generative AI requests in production applications - Correlate LLM traces with other application spans for end-to-end request tracing - Audit what data is being sent to and received from the Generative AI API - Evaluate model output quality by analyzing completions stored in trace attributes ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Automatically traces prompts, completions, and embeddings sent through the Google Generative AI library, exporting span data to OpenTelemetry collectors for observability and debugging. Yes, if you are using the Google Generative AI library and need observability into LLM calls. The package is actively maintained, has no security vulnerabilities, and integrates cleanly with the OpenTelemetry ecosystem. Install it if you already have an OpenTelemetry collector or exporter configured; otherwise, set up observability infrastructure first. ## Install pip install opentelemetry-instrumentation-google-generativeai uv add opentelemetry-instrumentation-google-generativeai poetry add opentelemetry-instrumentation-google-generativeai ## Installing opentelemetry-instrumentation-google-generativeai Before you install: Low friction install with four runtime dependencies on the OpenTelemetry ecosystem. Package is actively maintained with recent releases and no known vulnerabilities. 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-generativeai from opentelemetry.instrumentation.google_generativeai import GoogleGenerativeAiInstrumentor GoogleGenerativeAiInstrumentor().instrument() Requires Python 3.10 or later; OpenTelemetry collector or exporter must be configured separately to receive traces. Verify before relying: - Whether the package works with all versions of the Google Generative AI library or has specific version constraints - Performance overhead of instrumentation on high-volume LLM applications - Compatibility with non-Google OpenTelemetry exporters and backends ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 3.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags opentelemetry google gemini tracing, llm instrumentation observability, generative ai span tracing, prompt completion logging, ai application monitoring, observability, llm-tracing, google-gemini [View on SkillFed](https://skillfed.io/packages/opentelemetry-instrumentation-google-generativeai) · [View on PyPI](https://pypi.org/project/opentelemetry-instrumentation-google-generativeai/)