Skip to main content

Installation

Quick Start

What Gets Traced

  • generateContent — input text (user messages only), output, model, token usage (promptTokenCount/candidatesTokenCount)
  • Cached tokenscached_content_token_count from usage metadata → ai.usage.cached_tokens
  • Thinking tokensthoughts_token_count from usage metadata (Gemini 2.5) → ai.usage.thoughts_tokens
  • Finish reasoncandidate.finish_reason (STOP, MAX_TOKENS, SAFETY, RECITATION) → vertex_ai.finish_reason
  • Errors — captured with error status, re-thrown to caller

Configuration

Projects

Route events to a specific project by passing its slug as projectId (project_id in Python):
This sets the X-Raindrop-Project-Id header on every event. Omit it (or pass "default") to use your org’s default Production project, which is the existing behavior. Single-project orgs need nothing new.

Multiple projects in one process

Available in raindrop-ai>=0.0.56. When one service wraps several Vertex AI clients that should report to different projects, create one RaindropVertexAI wrapper per project. Each wrapper owns its own raindrop.Raindrop client, so the two route independently — there is no shared module-level state:
Each wrapper owns its configuration and delivery pipeline, so clients handled by different wrappers route independently. To share a single client across wrappers (or with the module-level API), construct a raindrop.Raindrop yourself and pass it via client=:

identify()

track_signal()

Flushing and Shutdown

finish_reason Tracking

The Python wrapper captures candidate.finish_reason from Vertex AI responses and maps it to vertex_ai.finish_reason in event properties. Possible values: STOP, MAX_TOKENS, SAFETY, RECITATION.

Token Tracking

The following token usage fields are captured from usage_metadata:

Factory Function

A create_raindrop_vertex_ai() factory is also available:

Known Limitations

  • Python SDK: No events.* API — use raindrop.analytics directly. identify() and track_signal() are available on the wrapper instance.
  • Streaming: generateContentStream() is not instrumented. Only generateContent() is traced.