Quick Start
Requires
google-genai 0.3.0 or later. The older google-generativeai package is not supported.What Gets Traced
The instrumentor automatically captures:- Content generation -
client.models.generate_content()with inputs, outputs, and token usage - Function calls - Each function call with arguments and results
- Chat sessions -
chat.send_message()with conversation history - Streaming responses - Streamed generations with aggregated tokens
Example: Content Generation
Environment Configuration
Troubleshooting
Traces not appearing
- Check environment variables - Ensure
HH_API_KEYis set - Pass the tracer provider - The instrumentor must receive
tracer_provider=tracer.provider:
- Initialize before making calls - Call
instrument()before creating thegenai.Client
SDK version
The instrumentor works with the newergoogle-genai SDK. If you’re using the older google-generativeai package, migrate to google-genai:
Related
Google ADK
Google Agent Development Kit integration
Enrich Your Traces
Add user IDs and custom metadata to traces
Distributed Tracing
Trace calls across service boundaries

