Use Cases
Explore common scenarios supported by the Time Range Blueprint:Serverless Functions
Bill based on function execution time and memory usage.
Container Runtime
Track container running time for usage-based billing.
Compute Instances
Monitor VM runtime and charge by the minute or hour.
Background Jobs
Track processing time for data exports, reports, and batch jobs.
Perfect for billing based on compute time, function execution duration, container runtime, or any time-based usage.
Quick Start
Track resource usage by time duration:1
Install the SDK
2
Get Your API Keys
- Dodo Payments API Key: Get it from Dodo Payments Dashboard
3
Create a Meter
Create a meter in your Dodo Payments Dashboard:
- Event Name:
time_range_usage(or your preferred name) - Aggregation Type:
sumto track total duration - Over Property:
durationSeconds,durationMinutes, ordurationMs
4
Track Time Usage
Configuration
Ingestion Configuration
string
required
Your Dodo Payments API key from the dashboard.
string
required
Environment mode:
test_mode or live_mode.string
required
Event name that matches your meter configuration.
Track Time Range Options
string
required
The customer ID for billing attribution.
number
Duration in milliseconds. Use for sub-second precision.
number
Duration in seconds. Most common for function execution and short tasks.
number
Duration in minutes. Useful for longer-running resources like VMs.
object
Optional metadata about the resource like CPU, memory, region, etc.