Skip to content

grafana: filtered events per node - #44

Open
s0me0ne-unkn0wn wants to merge 1 commit into
mainfrom
s0me0ne/add-event-per-node
Open

grafana: filtered events per node#44
s0me0ne-unkn0wn wants to merge 1 commit into
mainfrom
s0me0ne/add-event-per-node

Conversation

@s0me0ne-unkn0wn

@s0me0ne-unkn0wn s0me0ne-unkn0wn commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Closes #31.

The TART Global dashboard lets you pick an event group / event type, but there was no per-node breakdown of the selected events — no way to see which nodes are the top senders.

Backend

New endpoint GET /api/grafana/events-by-node: per-node totals for a set of event types over a range, ranked by count, each row joined with the node's handshake identity (address, implementation name/version, connection state, last seen) and its share of the network-wide total (computed over all nodes before limit, so shares stay meaningful when the list is truncated).

  • event_types accepts the same mix as /timeseries (numeric IDs, event names, group names, Grafana {a,b} braces); omitted = all types.
  • interval is a resolution hint that picks the aggregate tier (30 s counts / 1 m / 1 h aggregates); omitted, it is derived from the range length (~300 buckets, mirroring Grafana's $__interval).
  • Aggregation happens in SQL (GROUP BY node_id over the same tiers /timeseries reads), so the panel gets ≤ limit rows instead of buckets × nodes.

Tier selection is factored into a shared select_event_stats_table() used by both /timeseries and the new endpoint. Side fix: sub-minute intervals on ranges older than 30 days previously selected the _1m aggregates whose retention had already expired; they now fall back to _1h.

Grafana (TART Global, "Selected Events" row)

  • Selected Events by Node — timeseries of the selected event types with group_by=node_id, legend table sorted by total, 64-hex node ids shortened.
  • Top Senders (Selected Events) — table ranked by count: Node ID (links to the TART Node dashboard), Events (gauge), Share, Address, Impl, Version, Connected, Last Seen.

🤖 Generated with Claude Code (but I read it through and cut some slop, honest!)

@michalkucharczyk

michalkucharczyk commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

I am still not convinced if we need new endpoint, yeah, but let's keep it.
Maybe it shall be named events/by-node to match naming convetion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

garafana: filtered events per node

2 participants