Skip to main content

OpenTelemetry instrumentation for Google Gen AI

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

traceai_google_genai-0.1.1.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

traceai_google_genai-0.1.1-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file traceai_google_genai-0.1.1.tar.gz.

File metadata

  • Download URL: traceai_google_genai-0.1.1.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.2 Darwin/24.6.0

File hashes

Hashes for traceai_google_genai-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ead9eb68606be18e4703cce94c07c4a1bb7fe984e92358531ebbe7d47ccf3ca3
MD5 5361a52aacc372f9e9fc244033c31f74
BLAKE2b-256 2b79d0da639df11e81dda9b31b9451039ba6bd5c96bc61e846721528850ba89d

See more details on using hashes here.

File details

Details for the file traceai_google_genai-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for traceai_google_genai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c30b35adba28a2ebf00f1400eac7468bd5ca1d54b86926e5b9d4e0d76eb437ee
MD5 1cc151844eb87d8063fe1913bb9de130
BLAKE2b-256 e56fabb9226030deb3259fc6d86ea783dd80b4297c17dc67b9346b507ea480da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page