Cache the node metadata the telemetry feed already sends, and show it on the miner route #15
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The feed carries far more about a node than we read. We decode two fields of eleven from
NodeDetails— the name and the peer id — and drop the rest on the floor, including the hardware the miner is actually running on.The shapes, mapped from the live feed
Captured from
wss://feed-telemetry.quantus.cat/feedsubscribed to mainnet, 75 seconds, 287AddedNodeframes. Recording it here because the substrate-telemetry wire format is positional, undocumented in any version-specific way, and differs between releases — this is what this feed sends today.Action 3,
AddedNode— arity 8:details— arity 11, and the interesting one:sysinfois the one object in the whole format — keys stable across every sample:The update messages, which carry the volatile half:
Frame counts over those 75 seconds:
3×287,6×3832,7×4138,8×750,9×310,21×310. Volume is dominated by block imports, which we already handle; the metadata frames are cheap.What to cache
The slow-moving half is what belongs in Postgres, keyed by
network_id(the peer id), overwritten whenever a newer frame arrives: name, implementation, version, target os/arch/env, the whole ofsysinfo, location, andstartup_time.The volatile half — peer count, transactions in queue, bandwidth, state cache — should stay in memory and be read live. Persisting a bandwidth series per node would be a lot of rows for something nobody would page back through, and it is already a rolling series in the feed.
startup_timeis worth storing rather than deriving: it makes "node uptime" a fact about the node rather than about how long we have been watching, and it survives our restarts.The part that needs care
A miner is joined to a node by inference, and the hardware inherits that.
readme.mdis emphatic that an attributed name "is an inference, never a claim the miner made and never an identity check" — the join runs miner preimage → attribution →NodeKey::Peer→ this metadata, so every CPU model shown on a miner page rests on the same telemetry voting that gave it its name.That has to be visible in the UI, not buried. A miner whose attribution is a single lucky vote must not display a CPU as though the chain asserted it. The existing
confidenceandAttributionSourcealready travel with the row; this panel has to wear them.Two shapes that break a naive one-to-one:
Scope
NodeDetails+sysinfo+ location + startup intelemetry.rs, keyed by peer id.MinerDetail, ts-rs exported.Worth doing in that order, with (1) and (2) landing before any UI, because the mapping above is the part most likely to be wrong against a future feed version and the tests should pin it first.