askrobots / dbbasic-object-server
Public
Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.
danq9
signup: the person chooses the password and name on the confirm page
83c7aa6
2 weeks, 5 days ago
History
usage_summaries.json · 1.9 KB · 24 lines
| 1 | { |
| 2 | "name": "usage_summaries", |
| 3 | "title": "Usage Summaries", |
| 4 | "version": 1, |
| 5 | "description": "One subscription's total for one metric over one period -- the bucket rating actually reads. The indirection is deliberate and load-bearing: pricing that folded raw events would make a month of per-request rows part of every invoice render, and would weld the pricing logic to whatever shape the write side happens to have today. With summaries in between, metering can start batching or accumulating in memory later and not one line of pricing changes. Each bucket also carries the summed COST of the events behind it, so margin per customer per metric is a read, not a project.", |
| 6 | "fields": [ |
| 7 | {"name": "id"}, |
| 8 | {"name": "subscription_id", "label": "Subscription", |
| 9 | "relation": {"collection": "subscriptions", "display_field": "customer_name"}}, |
| 10 | {"name": "metric", "type": "text", "required": true, "label": "Metric"}, |
| 11 | {"name": "period_start", "type": "date", "required": true, "label": "Period Start"}, |
| 12 | {"name": "period_end", "type": "date", "required": true, "label": "Period End"}, |
| 13 | {"name": "quantity", "type": "number", "default": "0", "label": "Quantity"}, |
| 14 | {"name": "event_count", "type": "integer", "default": "0", "label": "Events"}, |
| 15 | {"name": "cost_minor", "type": "integer", "default": "0", "label": "Our Cost", |
| 16 | "help": "Summed from the events, so revenue minus this is margin for exactly this metric and customer."}, |
| 17 | {"name": "invoiced", "type": "boolean", "default": "false", "label": "Invoiced"}, |
| 18 | {"name": "owner_id", "type": "text", "label": "Owner"}, |
| 19 | {"name": "created_at", "type": "datetime", "read_only": true, "label": "Created"} |
| 20 | ], |
| 21 | "views": {"list_mode": "table", |
| 22 | "list_fields": ["period_start", "metric", "quantity", "cost_minor", "invoiced"], |
| 23 | "filter_fields": ["metric", "subscription_id", "invoiced"]} |
| 24 | } |