Product — the plugin that makes monetize speak one product's language.
monetize handles MANY products, and each product's plugin lives in this
repository. So monetize is
one service for gunnar.rs, holger.rs, njord, …, and each product is a crate under
products/<name> implementing this trait. The product itself carries only the thin
monetize-embed hook behind a cargo feature; it never learns what capacity costs.
product box ──Usage (gRPC, the product's own API)──▶ Product plugin ──▶ monetize core
product box ◀──Entitlement (product's own API)──── Product plugin ◀── monetize core
Two directions, both facts
- [
Product::read_usage] — what a tenant is consuming, in the product's own units (gunnar: pack bytes, read-cache bytes, LFS bytes, tombstoned bytes, open-store RAM; holger: whatever holger meters). The plugin maps them to [Usage], a flat bag of named meters, so core never has product-specific fields. - [
Product::push_entitlement] — the verdict, written back over the product's own control plane (gunnar:Entitlement.Setwithsource = payment:<vendor>:<ref>). Signed by monetize's key; the product appends it to its attestation log.
A plugin never blocks the product
Counting is done inside the product, always, open source — a self-hoster wants the numbers too. The plugin only reads them. If monetize is down the product keeps serving on its cached entitlement; the plugin's job on reconnect is to catch up, not to have been in the request path.