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

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)

Metadata

Release files for traceAI-google-genai 0.1.2

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.2
File Size Uploaded
traceai_google_genai-0.1.2.tar.gz 13.9 kB Details

Built distribution (wheel)

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

Total release size: 31.9 kB

Release files / traceai_google_genai-0.1.2.tar.gz

Download URL traceai_google_genai-0.1.2.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
646e5f25f02a3b42e3541a2191b785245d1c25ecd9aaf65005f6c96a780b2626
BLAKE2b-256 checksum
How to use checksums
10917a37efcc5e310cf0df96b2616056f1cdbfd0af2530d423f2f6855747f1b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL traceai_google_genai-0.1.2-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b123558398db6f8f5f98eb47f5865f9e52ea644994c0ccaaf78255ca957bc2a4
BLAKE2b-256 checksum
How to use checksums
4fe751e31b426e51527038ca34deb7c9ddd95d56bdcbfb1b08ccb62726ba5423
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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