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.2.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.2-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: traceai_google_genai-0.1.2.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for traceai_google_genai-0.1.2.tar.gz
Algorithm Hash digest
SHA256 646e5f25f02a3b42e3541a2191b785245d1c25ecd9aaf65005f6c96a780b2626
MD5 0341c352ba6bcec1df35474e7fcbec4a
BLAKE2b-256 10917a37efcc5e310cf0df96b2616056f1cdbfd0af2530d423f2f6855747f1b6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: traceai_google_genai-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for traceai_google_genai-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b123558398db6f8f5f98eb47f5865f9e52ea644994c0ccaaf78255ca957bc2a4
MD5 37a66e0b2269f3014758b551213774c2
BLAKE2b-256 4fe751e31b426e51527038ca34deb7c9ddd95d56bdcbfb1b08ccb62726ba5423

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