acme/prod/tenant_123, acme/prod/tenant_456 and more) and defines each judgment once, on acme/prod/*. Each tenant under acme/prod/ then gets the judgments, with no call for each tenant.
Templates are on the Team plan and above, so below Team these requests on a prefix return
plan_required: create, change or activate a judgment, and create or change a subscription.After a downgrade takes effect, a template freezes:- Its tenants continue to answer with its active version.
- Its subscriptions continue to send events.
- You can still read it, backfill it, delete its judgments and subscriptions, and detach tenants.
- You cannot change it.
- If it has an active judgment or a subscription, a write that would create a new namespace under it returns
plan_required.
Create a judgment on a prefix
A template’s path is a namespace path that ends in/*, and you create a judgment on that path as you create one on a namespace:
settles, the matching judgment in match one record to another, for each tenant. The request needs a key whose scope covers the whole prefix (acme/prod/* or wider), since the key you got at sign-up cannot reach it, and only an organization with a card on file can create one that does (get an API key). The judgment reads, for each unmatched payment, the open invoices that share the payment’s key, and picks the invoice that the payment settles.
confirm accepts the cost of keeping the answers current when invoices change. Without it, the create returns that estimate and creates nothing. See the replay estimate.
Send the * unchanged and each / as %2F (the SDKs do this for you).
These judgment routes work on the prefix path as they work on a namespace:
- create, list, get,
PATCHand delete - activate and backfill
- calibration, the list of fits, pins and named runs, and threshold recommendations
- recipe suggestions and tuning and the alternatives table, on the tenants’ pooled outcomes. A tenant reads the template’s.
invalid_request. A tenant’s draw follows the tenant’s own thresholds when it overrides the template’s.
Each namespace under acme/prod/ now has settles, so a tenant’s judgment list and get include it, with template naming the template that it comes from:
freshness, judged_through and versions (the list of each version with its definition).
Which template a namespace follows
- The most specific prefix wins, since templates do not nest. With templates on
acme/*and onacme/prod/*, the namespaceacme/prod/tenant_123gets only the judgments ofacme/prod/*, even after you deactivate every judgment onacme/prod/*. - A namespace’s own judgment wins. A namespace that already has a judgment with the template judgment’s name keeps its own, and does not get the template’s.
GET /templates (db.templates.list() in both SDKs) lists your organization’s templates, 100 on each page, with an optional prefix, and a template stays in the list after you deactivate its judgments. GET /namespaces does not list templates. To list the namespaces that a template applies to, use GET /namespaces?prefix=acme/prod/.
New and existing tenants
Brussle judges a namespace created after the template’s first version in full, from its first write. A new tenant’s first write creates its namespace, and your organization creates at most 1,000 new namespaces in each UTC minute (a template is not a namespace, so it does not count). To onboard more tenants than that at once, see create many tenants at once. A namespace can exist before you add the template judgment, and Brussle then treats it as if you created the judgment in that namespace at that time. For anon_change judgment, Brussle judges the documents written from then on. The existing documents wait for a backfill that you confirm, because Brussle backfills nothing without an estimate.
A backfill on the prefix path includes each tenant:
- Without
confirm, the estimate covers each namespace that follows the template’s judgment. Brussle counts up to 100 of them (spread evenly by name) and scales the count to all of them, so the estimate can be off when tenant sizes differ widely. Brussle also reuses each namespace’s counts for 5 minutes, so an estimate can miss the last few minutes’ writes. - With
"confirm": true, one job judges the namespaces one at a time, each inside its own budget. The job skips a namespace whose budget is paused and leaves that namespace’s answersstale. One paused namespace does not stop the rest.
Change the question for every tenant
- Create a new version on the prefix path.
- Activate the new version on the prefix path. You get one shadow report, sampled across the tenants, and the job’s
namespaceis the prefix. - Read the shadow report.
- Confirm the job once the report looks right, and each tenant switches to the new version.
- The confirm starts a backfill on the prefix path, at the cost of the report’s
recompute, which judges each tenant’s existing documents again with the new version as any backfill on the prefix path does. When the shadow job isdone, itsbackfill_job_idnames the backfill job. The id isnullwhen there was nothing to judge again. It is alsonullwhen the cost did not fit your organization’s balance (each tenant’s budget is checked as the backfill reaches it), and since the switch still happened, start the backfill yourself then.
force: true skips the report, as on a namespace, and starts no backfill.
Tenants always follow the template’s active version, so in each tenant an answer from the earlier version reads stale (with stale_reason older_version) until the backfill or the document’s next change judges it again. answers: "fresh_only" leaves those answers out, so old and new answers do not mix silently. A version that changes only the thresholds judges in the same way, so its answers stay fresh. Each answer records its judgment_version, and a query can filter on it.
Override settings for one tenant
A tenant can override two settings of a judgment that it gets from a template: the thresholds and the freshness policy. You send the usualPATCH on the tenant’s own path, and the judgment’s overrides lists the settings that the tenant overrides.
- An override replaces the whole object. A thresholds override replaces the template’s full set of thresholds, as each threshold
PATCHdoes. A freshness override is the full freshness setting, so a later template change to the debounce does not reach a tenant that overrides freshness. - A
PATCHon the prefix path changes the settings of each tenant that has no override of them. When a judgment in those tenants reads a threshold that thePATCHchanges (the template’s or a tenant’s own), thePATCHreturns the cost of those readers and needsconfirm. After the confirm, Brussle judges again the readers whose rendering changes, in each of those tenants. See roll-ups. - A tenant cannot set
calibration. APATCHwithcalibrationon a tenant’s path isinvalid_request, so pin a fit for every tenant on the prefix path instead.
Detach a judgment
A tenant that needs more than an override can detach the judgment into its own copy:ns.judgments.detach(name), and the detached judgment stops following the template.
- It keeps the template’s version numbers, up to and including the active version, and the active version stays active.
- It keeps the tenant’s thresholds and freshness that applied at the time, from an override or from the template.
- It keeps its answers and evaluations, and Brussle judges nothing again.
- It loses the template’s pooled correction. Its answers have no
calibratedobject until Brussle applies a fit on the tenant’s own outcomes. To give a tenant its own correction and keep the template, let it grow its own correction instead.
Subscriptions for every tenant
A subscription that you create on the prefix path applies to each tenant under the prefix, including tenants that you create later. The rules for which template a namespace follows apply to subscriptions too:- Each tenant separately. Each tenant keeps its own set of matching documents, and each event names the tenant in
namespaceand the prefix insubscription.defined_on. Brussle starts to check the subscription in a tenant at the tenant’s next change, so an idle tenant does no subscription work (until that change, the subscription readssyncingin that tenant). - Listed with
template. A tenant’s subscription list and get include the subscription, marked with the template, and show itsstatusin that tenant. On the prefix path,status,live_atandlag_msare null. - Managed on the prefix. Change and delete the subscription on the prefix path, since on a tenant’s path these requests get
409 conflict. The subscription’s query runs on a tenant’s path, over that tenant’s documents. - Its endpoint must include the full prefix, so use an endpoint scoped to
acme/prod/or wider, not to one tenant. - The limit. A tenant can create a subscription only while it has fewer than 100, counting its template’s. A create on the prefix checks only the template’s own count, so subscriptions that the template gets later can take a tenant past 100.
- Plans. A create or a change on a prefix needs the Team plan, as each template change does. After a downgrade, existing subscriptions continue to send events, and a delete works on each plan. A write that would create a new tenant under the frozen template returns
plan_required, and nothing is created.
What a tenant cannot do
These requests on a judgment that the tenant gets from a template return409 conflict:
- Create a judgment with the same name.
- Activate a version. The tenant follows the template’s active version.
- Delete the judgment. Detach it first.
- Change or delete a subscription that the tenant gets from the template. You cannot detach a subscription.
invalid_request.
These take a namespace, never a prefix: detach, the labelling queue, a subscription’s query, suggested parts, outcomes, documents, queries and writes.
Calibration across tenants
Tenants post outcomes on their own namespace paths, and the template pools them into one correction for each version and engine epoch, which every tenant reads from its first answer. On Team and Scale, a tenant with 50 outcomes of its own (15 of each kind) can also get its own correction, held toward the pool’s. You set pins, promotions and named runs on the prefix path, and the report on a tenant’s path says which correction the tenant reads and why. See per-customer corrections.What stays per tenant
A template’s judgment on your own model runs in each tenant on the key that tenant resolves: its namespace’s own key for the provider, else the organization’s. Answers, evaluations, budgets and billing stay with each tenant’s namespace. The limit of 100 active judgments counts only a namespace’s own judgments, and a template has its own limit of 100.In the dashboard
- The Templates page lists your templates and the tenants of each template.
- A tenant’s judgment shows the template that it comes from, and marks the settings that the tenant overrides.
- Detach asks you to confirm before it runs.
- A tenant’s Calibration section says, for each epoch, whether the tenant reads its own fit or the pool, and how much its own outcomes count. On a
boolwith features, it shows the tenant’s weights beside the pool’s. A template’s Calibration section shows how many tenants read their own fit. Below Team, both sections say that each tenant reads the pool, and offer owners an upgrade. - Below Team, the Templates page and each template say what templates do and that your templates are frozen, and offer owners an upgrade. A frozen template’s page still offers backfill, but its new versions, activation and settings wait for an upgrade.