grafana: filtered events per node - #44
Open
s0me0ne-unkn0wn wants to merge 1 commit into
Open
Conversation
michalkucharczyk
approved these changes
Sep 2, 2026
Contributor
|
I am still not convinced if we need new endpoint, yeah, but let's keep it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 itsshareof the network-wide total (computed over all nodes beforelimit, so shares stay meaningful when the list is truncated).event_typesaccepts the same mix as/timeseries(numeric IDs, event names, group names, Grafana{a,b}braces); omitted = all types.intervalis 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).GROUP BY node_idover the same tiers/timeseriesreads), so the panel gets ≤limitrows instead of buckets × nodes.Tier selection is factored into a shared
select_event_stats_table()used by both/timeseriesand the new endpoint. Side fix: sub-minute intervals on ranges older than 30 days previously selected the_1maggregates whose retention had already expired; they now fall back to_1h.Grafana (TART Global, "Selected Events" row)
group_by=node_id, legend table sorted by total, 64-hex node ids shortened.🤖 Generated with Claude Code (but I read it through and cut some slop, honest!)