busy band of abuse reports this week?”). Brussle publishes one document of band labels for each tenant into your template’s namespace each hour, and you read, query and judge those documents like any others.
Brussle keeps each tenant’s namespace apart on purpose and nothing reads across namespaces, so a tenant summary is the one way to get data up from the tenants:
- A template publishes one tenant document for each namespace under it.
- Brussle writes these documents into the template’s own namespace.
- Each tenant document comes from that tenant’s groups, converted into bands.
- A tenant document holds band labels, and never the value of an aggregate.
- Key values come from your tenants’ attributes, and a tenant document holds only the key values that you list.
- A judgment over tenant documents reads no text of a tenant, only the labels that each tenant published.
Set up a tenant summary
Here each tenant underacme/prod/* has two template groups:
abuse_by_day: its key is a day value that you write, and it keeps the last 7 days.by_plan: its key is the plan.
groups: the groups that each tenant publishes.bands: a band for each aggregate that you want to read.keys: the key values that you want to publish one by one.
POST /v1/namespaces/acme%2Fprod%2F*/tenant_summary
- Each group must exist on the template.
- Each key of
bandsnames one of the aggregates of these groups as<group>.<aggregate>, with the same name as in the group’s rows. - A value gets the label at the position equal to the number of cut points at or below it, so with cut points 10 and 100 the value 50 gets
some. Each band setting has one more label than cut points. keysis optional. Each group that it names must be ingroups, with the key values that you want to see one by one.
pending.
What a tenant document holds
A run reads each tenant’s group rows each hour and writes the tenant’s document into the template’s namespace (hereacme/prod):
idis the name of the tenant’s namespace, andattributes.kindistenant.state.groupsholds only labels.- The
allof each group gives the band of each aggregate over all its key values together (here, the abuse count over the 7 days thatabuse_by_daykeeps). - A group that you listed in
keysalso haskeys, which holds the labels of each listed key value that the tenant has. This tenant has nofreerow, sofreeis absent. - An aggregate without a band does not show, and neither does a key value that you did not list.
- The
state.sourcesays where the labels came from, without any of the tenant’s data.as_ofis the position in the tenant’s history at which the labels are exact.state.published_atis when the run wrote the document.
Query your tenants
A tenant document is an ordinary document, so to read the bands of all your tenants, query the tenant documents with theirstate:
POST /v1/namespaces/acme%2Fprod/query
state.groups, and you page through the rows with next_cursor.
A query cannot filter on state, so a query cannot choose tenants by band, and a subscription cannot watch a band. You have two choices:
- Apply your rule in your own code. For example, list the tenants whose
abuse_by_dayband isbusy, and compare the rows with the rows that you read last time to find a tenant that moved up a band. - Judge the tenant documents, since an answer is a field that queries and subscriptions can filter on. See judge your tenants.
Judge your tenants
One tenant document holds the bands of one moment, so one set of labels cannot show that abuse is rising. To ask about a change, addprevious to the recipe, and the engine then sees the labels as the last answer saw them, beside the labels now:
POST /v1/namespaces/acme%2Fprod/judgments
- When Brussle judges. Brussle judges a tenant document when the run writes it, which is when the tenant’s labels change. A write that changes no label that the judgment reads makes no engine call.
- The first answer. The first evaluation of a tenant document has no previous labels, so the criteria tell the engine to answer no then.
- Get told. A subscription on
["answers.abuse_moved_up.thresholds.moved_up", "Eq", true]sendssubscription.enteredwhen a tenant’s answer starts to hold the threshold, andsubscription.exitedwhen the answer stops holding it. - Thresholds.
moved_upis 0.5, a starting value, so measure it with outcomes.
state.source.as_of on the document is the position in the tenant’s history at which the labels are exact.
Check how current each tenant is
GET lists each tenant by name, with its status:
GET /v1/namespaces/acme%2Fprod%2F*/tenant_summary
A tenant document can be more than an hour late:
- A group’s rows are at most about one hour behind the tenant’s writes.
- The run reads the rows each hour, and goes through your tenants page by page.
published_at and source_as_of instead.
Change or stop it
- Groups, bands and keys. Change them with
PATCH, where each value that you send replaces the full setting. The next run rewrites each tenant document whose labels change, and Brussle judges each of those documents again. So aPATCHwithout"confirm": truechanges nothing and returns what the change costs, with one line for each judgment on the template’s namespace that reads tenant documents. Send it again with"confirm": true, and the change applies from the next run with no more action from you. - Delete with
DELETE. The runs stop, and the tenant documents stay as ordinary documents.
Tenants that come and go
- A new tenant under the template gets its document at the first run after its groups first have rows.
- When you delete a tenant and create it again with the same name, Brussle deletes its document and writes it again. The history of each judgment of that document splits at the new incarnation, as the tenant’s history does.
- Brussle deletes a tenant document only when it has confirmed that the tenant’s namespace is deleted, and never only because a list did not show the tenant.
Billing and failures
Tenant documents are writes to the template’s namespace, so they bill your organization as writes and stored bytes, namedtenant_summary in usage. Judgments over them bill as any judgment does, and a tenant with no changes writes nothing.
When the template’s namespace refuses the writes (for example because it is over its budget with on_exceeded: reject):
- The tenant summary shows the warning
tenant_summary_failed. - The events feed has one
namespace.tenant_summary_failedfor the run, with the reason.