Skip to content

Aggregator Selection

Trust

An aggregator is considered only if it is trusted:

Setting Trusts
trusted_l2 Aggregators with these keys
trusted_clusters Aggregators announced by these cluster controllers
trust_any Every announced aggregator

Candidates

A candidate is registered within a day, sent a heartbeat with status live within two minutes, and is global or serves the node's cluster.

Policy

MetricsWriter(..., policy={
    "filter": [{"field": "metadata.region", "op": "eq", "value": "eu"}],
    "order": [{"field": "metadata.rank"}, {"field": "heartbeat_age", "desc": True}],
})

Fields are l2_id, pubkey, url, ping_url, l2_type, cluster_id, heartbeat_age and metadata.*. Operators are eq, ne, lt, le, gt, ge, in, contains, exists and prefix. All filters must hold.

choose is a Python function that receives the ranked candidates and returns the ones to use, in order.

Ping

Before an aggregator is selected, and at every health check, it is pinged with a random nonce. It must answer with a signature by its announced key. This proves that the process behind the address holds the key.

Replacement

An aggregator that fails failures checks in a row, disappears from the relays or changes its address is replaced by the next candidate.