Dashboard traffic: the packet bucket breaks out by payload class
The lone "packet" meter lumped every overheard raw frame together; the traffic panel now meters each parsed payload class on its own row — channel text, trace, path, request, … — glossed and iconed from the packet viewer's shared tables, with only class-less frames left as a bare "packet". The composite packet:<TYPENAME> bucket shape runs through the stored seed (Repository.kind_counts) and the live tally (MonitorService) alike; an overheard ADVERT/ACK frame reads "raw advert"/"raw ack" so no two meters share a label. Raw-class meters stay muted — colour keeps marking the decoded families. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
79410c4f16
commit
dcc98f9cd8
4 files changed
+143
-26
No files matched your search
@@ -1376,23 +1376,30 @@ class Repository:
|
||||
|
||||
The persistent seed of the dashboard's traffic panel: what the recorder has
|
||||
heard across sessions, by kind, so the panel opens populated instead of
|
||||
counting from zero every launch. Messages and acks are separate event
|
||||
families (not observations) and are counted live on top of this.
|
||||
counting from zero every launch. A raw ``packet`` frame carrying a parsed
|
||||
payload class buckets as ``packet:<TYPENAME>`` (``packet:GRP_TXT``,
|
||||
``packet:TRACE``, …) so the panel can name what the frames were; only a
|
||||
class-less frame stays a bare ``packet``. Messages and acks are separate
|
||||
event families (not observations) and are counted live on top of this.
|
||||
|
||||
Args:
|
||||
since: Only observations at or after this time, if given.
|
||||
|
||||
Returns:
|
||||
``kind → count`` for every packet class ever stored (in the window).
|
||||
``bucket → count`` for every packet class ever stored (in the window).
|
||||
"""
|
||||
sql = "SELECT kind, COUNT(*) AS n FROM observations"
|
||||
sql = (
|
||||
"SELECT CASE WHEN kind = 'packet' AND payload_typename IS NOT NULL "
|
||||
"THEN 'packet:' || payload_typename ELSE kind END AS bucket, "
|
||||
"COUNT(*) AS n FROM observations"
|
||||
)
|
||||
params: list[Any] = []
|
||||
if since is not None:
|
||||
sql += " WHERE observed_at >= ?"
|
||||
params.append(since.isoformat())
|
||||
sql += " GROUP BY kind"
|
||||
sql += " GROUP BY bucket"
|
||||
rows = self._conn.execute(sql, params).fetchall()
|
||||
return {row["kind"]: row["n"] for row in rows}
|
||||
return {row["bucket"]: row["n"] for row in rows}
|
||||
|
||||
def prune_observations(self, older_than: datetime) -> int:
|
||||
"""Delete observations that aged past the retention window (housekeeping).
|
||||
|
||||
Reference in new issue
Block a user