Skip to main content

Google Gen AI OpenTelemetry Integration

Overview

This integration provides support for using OpenTelemetry with the Google Gen AI framework. It enables tracing and monitoring of applications built with Google Gen AI.

Installation

  1. Install traceAI Google Gen AI
pip install traceAI-google-genai

Supported SDK: google-genai>=1.8.0; offline sync/async streaming trace tests verified on 1.8.0, 1.24.0, and 3.0.0.

Set Environment Variables

Set up your environment variables to authenticate with FutureAGI

import os

os.environ["FI_API_KEY"] = FI_API_KEY
os.environ["FI_SECRET_KEY"] = FI_SECRET_KEY

Quickstart

Register Tracer Provider

Set up the trace provider to establish the observability pipeline. The trace provider:

from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType

trace_provider = register(
    project_type=ProjectType.OBSERVE,
    project_name="google_genai_project"
)

Configure Google Gen AI Instrumentation

Instrument the Google Gen AI client to enable telemetry collection. This step ensures that all interactions with the Google Gen AI SDK are tracked and monitored.

from traceai_google_genai import GoogleGenAIInstrumentor

GoogleGenAIInstrumentor().instrument(tracer_provider=trace_provider)

Make a request

Set up your Google Gen AI client with built-in observability.

from google import genai
from google.genai import types

client = genai.Client(vertexai=True, project="your_project_name", location="global")

content = types.Content(
    role="user",
    parts=[
        types.Part.from_text(text="Hello how are you?"),
    ],
)
response = client.models.generate_content(
    model="gemini-2.0-flash-001", contents=content
)

print(response)

Streaming output

For synchronous and asynchronous generate_content_stream calls, the exported output.value preserves each candidate's parts in arrival order. Parallel tool calls, repeated calls to the same function, and media parts remain distinct. Text chunks are still concatenated in the message-content span attribute. The response chunks delivered to your application are unchanged.

Metadata

Release files for traceAI-google-genai 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for traceAI-google-genai 0.1.4
File Size Uploaded Provenance Actions
traceai_google_genai-0.1.4.tar.gz 15.8 kB With provenance Details for traceai_google_genai-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for traceAI-google-genai 0.1.4
File Interpreter ABI Platform Actions
traceai_google_genai-0.1.4-py3-none-any.whl Python 3 none any Details for traceai_google_genai-0.1.4-py3-none-any.whl

Total release size: 35.2 kB

Release files / traceai_google_genai-0.1.4.tar.gz

Download URL traceai_google_genai-0.1.4.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
aaeb4b1e5940de932119c0e819c9d8c7cd9fd71db8d7ed568b60a356094771af
BLAKE2b-256 checksum
How to use checksums
f539672eb2d0faad1c1430b57d91ac0f5bf7a3a16f805d69e6f67c29ce2ee06f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / traceai_google_genai-0.1.4-py3-none-any.whl

Download URL traceai_google_genai-0.1.4-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afd02e984c8ae3117cafea193b11db5f6fa259f2b56fcdcf323ee0840ec3acda
BLAKE2b-256 checksum
How to use checksums
53857716acaa2b07e3575dee7f57855e194ef9af13e1c4062d434e00c0af1392
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Security for traceAI-google-genai 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for traceai_google_genai-0.1.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page