Use Cases
Practical metering patterns you can build with Open Spanner.
Open Spanner is useful whenever your product needs a trusted record of usage: billing, limits, customer reporting, operations, audits, or internal analytics. The core pattern is the same across use cases:
- Define a meter for the thing being measured.
- Send usage events from trusted backend code.
- Add dimensions for the fields you need to filter, group, export, or explain.
- Query buckets, breakdowns, and events when you need totals or detail.
Common Patterns
API Request Metering
Track request volume by endpoint, method, status, and region.
AI Token Usage
Measure token consumption by model, provider, operation, and cache path.
Storage Usage
Report capacity usage by tier, region, and resource type.
Active Users
Meter seats, workspaces, or active user counts over time.
Background Jobs
Track async work by queue, status, and worker region.
Feature Usage
Understand which product features customers actually use.
Historical Backfill
Import older usage safely with stable idempotency keys.
In-Doc Examples
Each use-case guide includes the meter definition, usage payload, and the dimensions that matter for that scenario.
| Use case | Example |
|---|---|
| API request metering | Create an API request meter and record request usage |
| Active users | Record active user activity or seat snapshots |
| AI token usage | Meter model/provider token consumption |
| Storage usage | Record storage capacity snapshots |
| Background jobs | Track queue throughput and job outcomes |
| Feature usage | Track product feature adoption |
| Historical backfill | Import historical events safely |
For backend services that continuously emit usage over gRPC, start with stream-native examples:
| Stream use case | What it records |
|---|---|
| Device telemetry | High-frequency device readings grouped by device, fleet, and region. |
| WebSocket sessions | Session duration or connection counts emitted as sessions open and close. |
| Queue consumer throughput | Message handling volume grouped by queue, outcome, and worker region. |