Checking Usage
Query current period consumption — eventually consistent for dashboards, exact for invoicing.
Two Usage Query Modes
ABAXUS provides two distinct APIs for querying usage, each with different consistency guarantees and performance characteristics. Choosing the right one for your use case is important.
GET /v1/usage/summary — Eventually Consistent
The summary endpoint returns pre-computed aggregate totals from ABAXUS’s internal materialized view. These aggregates are updated continuously as events are processed from the queue, but there is a short lag between event ingestion and aggregate update.
| |
Response:
| |
The meta.lag_seconds field tells you how stale the aggregate is — the number of seconds between the most recent event processed and the current wall clock time. Under normal operating conditions, this is under 30 seconds. During high-volume ingestion spikes, it may reach a few minutes.
When to use it:
- Customer-facing usage dashboards that refresh periodically
- Internal monitoring and alerting
- Any context where near-real-time data is acceptable
- High-frequency polling (the pre-computed nature makes it fast and cheap)
POST /v1/usage/compute — Exact, On-Demand
The compute endpoint scans raw events directly — bypassing the pre-computed aggregates — and returns an exact usage total. This is the correct API to use before issuing invoices or any time you need to be certain the total is accurate.
| |
Response:
| |
The meta.late_event_count field tells you how many events in the result had timestamps earlier than the period_start but arrived (were ingested) after the period had already ended. These are events that would have been missed by a naive cutoff-date approach. ABAXUS includes them in the compute result because they represent real usage that occurred within the period.
When to use it:
- Immediately before creating an invoice
- When a customer disputes a charge and you need the authoritative total
- After a backfill operation to verify the corrected totals
- One-time data reconciliation tasks
Querying All Metrics for a Customer
To get a usage summary for all active metrics at once:
| |
Response:
| |
This is the recommended approach for building a customer usage dashboard — one request gives you the full picture.
Usage Histograms
For more granular views (daily or hourly breakdowns), use the histogram endpoint:
| |
This returns a time-series breakdown of usage, useful for rendering usage charts in your customer portal.