Contents

Chapter 1

Features

This chapter covers the core features and capabilities of Usage Metering.

Features

  • Event recording — Track any metric (API calls, storage, compute, custom)
  • Quota enforcement — Per-plan limits with configurable overage policies
  • Idempotency — Dedup protection prevents double-counting on retries
  • Usage summaries — Aggregate by tenant, metric, and billing period
  • Billing reports — Generate billing-ready reports with overage calculations
  • Top users — Identify heaviest users within a tenant
  • Batch recording — Record multiple events in one call
  • Plan management — Define usage plans with per-metric quotas

Requirements

  • Python 3.10+
  • No external dependencies (stdlib only)
Chapter 2

Quick Start

Follow this guide to get Usage Metering up and running in your environment.

Quick Start

bash
python src/main.py --init-demo
bash
# Record usage
curl -X POST http://localhost:8005/api/events \
  -H "Content-Type: application/json" \
  -d '{"tenant_id": "tenant_acme", "metric": "api_calls", "quantity": 1, "user_id": "user_1"}'

# Check usage
curl http://localhost:8005/api/usage/tenant_acme/api_calls

# Check quota
curl http://localhost:8005/api/quota/tenant_acme/api_calls

# Generate billing report
curl -X POST http://localhost:8005/api/billing-report \
  -H "Content-Type: application/json" \
  -d '{"tenant_id": "tenant_acme"}'

API Endpoints

MethodPathDescription
POST/api/eventsRecord a usage event
GET/api/usage/:tenant/:metricGet usage summary
GET/api/quota/:tenant/:metricCheck quota status
POST/api/billing-reportGenerate billing report
Chapter 3
🔒 Available in full product

Project Structure

You’ve reached the end of the free preview

Get the full Usage Metering and unlock everything.

All Chapters

Get the complete guide with every chapter unlocked, including code samples, diagrams, and best practices.

Full Tool Suite

Access all interactive tools with complete data, all workload profiles, and the full scenario library.

Source Files

Downloadable source code, configuration files, and working examples from every chapter.

Lifetime Updates

Free updates for life. Every new chapter, tool, and improvement included.

Buy Now — $19 →
📦 Free sample included — download another copy for the full product.
Usage Metering v1.0.0 — Free Preview