| … | … | @@ -273,6 +273,27 @@ export async function startMembrane (cfg, { log = defaultLog, bootstrap = null } |
| 273 | 273 | status: () => ({ ok: true, membrane: true, port, fronted: peers.list() }), |
| 274 | 274 | // The relay guard's last pass and heals, for `metrics`. Read-only. |
| 275 | 275 | guard: () => ({ ...guard }), |
| 276 | // What the gateway's panel and CLI show for this role, from local state only — no network call. |
| 277 | // Per fronted DID: the served co-owner's handle and head rev, how many co-owner fronts are cached and |
| 278 | // how many are connected now, when its firehose last appended, rival lines refused and keys denied. |
| 279 | metrics: () => { |
| 280 | const d = peers.diagnose() |
| 281 | const dids = d.fronted.map((did) => { |
| 282 | const fronts = d.fronts.filter((f) => f.did === did) |
| 283 | const served = fronts.find((f) => f.served) || fronts[0] || null |
| 284 | return { |
| 285 | did, |
| 286 | handle: served ? served.handle : null, |
| 287 | rev: served ? served.rev : null, |
| 288 | fronts: fronts.length, |
| 289 | live: fronts.filter((f) => f.live).length, |
| 290 | lastAppendAt: (d.lastAppendAt && d.lastAppendAt[did]) || null, |
| 291 | forkRejected: fronts.reduce((n, f) => n + (f.forkRejected || 0), 0), |
| 292 | denied: (d.denied[did] || []).length |
| 293 | } |
| 294 | }) |
| 295 | return { dids, relay: { emitted: relay.length, seqBase: relay.seqBase }, guard: { ...guard } } |
| 296 | }, |
| 276 | 297 | // The stop sequence, unchanged in order from pds-serve.js (control is the caller's, so it is not |
| 277 | 298 | // here), plus the seq-guard timer. |
| 278 | 299 | steps: [ |