Watch
0
0
Fork
You've already forked hyperhive
0

egress board: join the host tables by labels, one row per group

labelsToFields and merge left a __name__ column and one row per stat on
the multi-stat table. joinByLabels gives a column per stat.
This commit is contained in:
iris 2026-11-01 13:00:47 +01:00 • committed by mara
commit ed86356928
2 changed files with 28 additions and 35 deletions

View file

@ -798,17 +798,13 @@
],
"transformations": [
{
"kind": "labelsToFields",
"kind": "joinByLabels",
"spec": {
"id": "labelsToFields",
"options": {}
"id": "joinByLabels",
"options": {
"join": ["dest"],
"value": "__name__"
}
},
{
"kind": "merge",
"spec": {
"id": "merge",
"options": {}
}
},
{
@ -1038,17 +1034,13 @@
],
"transformations": [
{
"kind": "labelsToFields",
"kind": "joinByLabels",
"spec": {
"id": "labelsToFields",
"options": {}
"id": "joinByLabels",
"options": {
"join": ["agent", "dest"],
"value": "__name__"
}
},
{
"kind": "merge",
"spec": {
"id": "merge",
"options": {}
}
},
{
@ -1407,17 +1399,13 @@
],
"transformations": [
{
"kind": "labelsToFields",
"kind": "joinByLabels",
"spec": {
"id": "labelsToFields",
"options": {}
"id": "joinByLabels",
"options": {
"join": ["agent", "dest", "port"],
"value": "__name__"
}
},
{
"kind": "merge",
"spec": {
"id": "merge",
"options": {}
}
},
{

View file

@ -496,15 +496,20 @@ let
&& lib.all (e: lib.hasInfix "\"TCP_\"*" e) (
lib.filter (e: lib.hasInfix access e) (exprs ++ [ agentVar.spec.query.spec.query ])
)
# A grouped stats query is one frame per group, which a table panel shows as
# a dropdown of series; labels to columns, then a merge, makes the rows.
# A grouped stats query is one frame per group and stat, which a table panel
# shows as a dropdown of series; joining by the group labels, with the stat's
# name as the column, makes one row per group.
&& lib.all (
e:
map (t: t.spec.id) e.spec.data.spec.transformations == [
"labelsToFields"
"merge"
let
xf = e.spec.data.spec.transformations;
in
map (t: t.spec.id) xf == [
"joinByLabels"
"organize"
]
&& (lib.head xf).spec.options.value == "__name__"
&& (lib.head xf).spec.options.join != [ ]
) (lib.filter (e: e.spec.vizConfig.group == "table") (lib.attrValues board.spec.elements))
&& lib.hasInfix "logformat would_deny would_deny user=%[un method=%rm host=%>rd port=%>rP result=" squid
&& lib.hasInfix "access_log syslog:daemon.info squid !manager" squid;