agents board: a busiest-agents table, joined by agent
Five instant table-format queries, one per column, joined on the agent label, sorted by turns. Checked in a real Grafana 13 against a mock Prometheus.
This commit is contained in:
parent
696c199621
commit
fec66af1c8
1 changed files with 235 additions and 1 deletions
|
|
@ -453,6 +453,31 @@ let
|
|||
]
|
||||
&& lib.all (m: lib.hasInfix "\"${m}\"" recorded) queried;
|
||||
}
|
||||
{
|
||||
# The agents board's busiest-agents table is five instant queries, one per
|
||||
# column, in table format. Joining them by agent is what makes it one row per
|
||||
# agent; without the join a table panel shows a frame per query.
|
||||
name = "the agents dashboard's busiest-agents table joins its queries by agent";
|
||||
ok =
|
||||
let
|
||||
board = builtins.fromJSON (builtins.readFile ../host-modules/swarm-grafana/dashboards/agents.json);
|
||||
tables = lib.filter (e: e.spec.vizConfig.group == "table") (lib.attrValues board.spec.elements);
|
||||
table = lib.head tables;
|
||||
xf = table.spec.data.spec.transformations;
|
||||
in
|
||||
lib.length tables == 1
|
||||
&& table.spec.title == "Busiest agents"
|
||||
&& lib.length table.spec.data.spec.queries == 5
|
||||
&& lib.all (
|
||||
q: q.spec.query.spec.format == "table" && q.spec.query.spec.instant
|
||||
) table.spec.data.spec.queries
|
||||
&&
|
||||
map (t: t.spec.id) xf == [
|
||||
"joinByField"
|
||||
"organize"
|
||||
]
|
||||
&& (lib.head xf).spec.options.byField == "agent";
|
||||
}
|
||||
{
|
||||
# The egress board ships, and its queries read the two squid log lines as
|
||||
# squid writes them: the would_deny line's field layout, and the default
|
||||
|
|
|
|||
Loading…
Reference in a new issue