swarm-grafana: sort multi-series bargauge panels by value
Bargauge panels display series in the order the datasource returns them — Grafana has no native sort for that (long-standing upstream gap, grafana#17245). The reliable fix is sorting at the PromQL level with sort_desc() on an instant vector, which forge.json's 'Issues by label' panel already does. Applies the same pattern to the other 14 multi-series bargauge panels across agents.json, claude-usage.json, and authelia.json (the latter two also needed instant: true added, since sort_desc only works on instant vectors). logstore.json's two VictoriaLogs-backed bargauge panels use LogsQL, not PromQL, and are left out of this pass — LogsQL's sort-after-stats has a documented ordering bug in some versions; needs its own verification.
This commit is contained in:
parent
6050033fbc
commit
c7f6c33321
3 changed files with 16 additions and 14 deletions
|
|
@ -644,7 +644,7 @@
|
|||
"name": "@datasourceUid@"
|
||||
},
|
||||
"spec": {
|
||||
"expr": "sum by (agent) ({__name__=\"hyperhive.container.storage.usage\", hive=~\"$hive\", agent=~\"$agent\"})",
|
||||
"expr": "sort_desc(sum by (agent) ({__name__=\"hyperhive.container.storage.usage\", hive=~\"$hive\", agent=~\"$agent\"}))",
|
||||
"instant": true,
|
||||
"legendFormat": "{{agent}}"
|
||||
}
|
||||
|
|
@ -795,7 +795,7 @@
|
|||
"name": "@datasourceUid@"
|
||||
},
|
||||
"spec": {
|
||||
"expr": "sum by (agent) (increase({__name__=\"claude_code.active_time.total\", hive=~\"$hive\", agent=~\"$agent\"}[$__range]))",
|
||||
"expr": "sort_desc(sum by (agent) (increase({__name__=\"claude_code.active_time.total\", hive=~\"$hive\", agent=~\"$agent\"}[$__range])))",
|
||||
"instant": true,
|
||||
"legendFormat": "{{agent}}"
|
||||
}
|
||||
|
|
@ -1209,7 +1209,7 @@
|
|||
"name": "@datasourceUid@"
|
||||
},
|
||||
"spec": {
|
||||
"expr": "sum by (subagent) (increase({__name__=\"claude_code.cost.usage\", hive=~\"$hive\", agent=~\"$agent\", subagent!=\"\"}[$__range]))",
|
||||
"expr": "sort_desc(sum by (subagent) (increase({__name__=\"claude_code.cost.usage\", hive=~\"$hive\", agent=~\"$agent\", subagent!=\"\"}[$__range])))",
|
||||
"instant": true,
|
||||
"legendFormat": "{{subagent}}"
|
||||
}
|
||||
|
|
@ -1285,7 +1285,7 @@
|
|||
"name": "@datasourceUid@"
|
||||
},
|
||||
"spec": {
|
||||
"expr": "sum by (agent) (increase({__name__=\"claude_code.cost.usage\", hive=~\"$hive\", agent=~\"$agent\", subagent!=\"\"}[$__range]))",
|
||||
"expr": "sort_desc(sum by (agent) (increase({__name__=\"claude_code.cost.usage\", hive=~\"$hive\", agent=~\"$agent\", subagent!=\"\"}[$__range])))",
|
||||
"instant": true,
|
||||
"legendFormat": "{{agent}}"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,7 +255,8 @@
|
|||
"type": "prometheus",
|
||||
"uid": "@datasourceUid@"
|
||||
},
|
||||
"expr": "sum by (code) (increase(authelia_request[$__range]))",
|
||||
"expr": "sort_desc(sum by (code) (increase(authelia_request[$__range])))",
|
||||
"instant": true,
|
||||
"legendFormat": "{{code}}"
|
||||
}
|
||||
],
|
||||
|
|
@ -302,7 +303,8 @@
|
|||
"type": "prometheus",
|
||||
"uid": "@datasourceUid@"
|
||||
},
|
||||
"expr": "sum by (code) (increase(authelia_authz[$__range]))",
|
||||
"expr": "sort_desc(sum by (code) (increase(authelia_authz[$__range])))",
|
||||
"instant": true,
|
||||
"legendFormat": "{{code}}"
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@
|
|||
"type": "prometheus",
|
||||
"uid": "@datasourceUid@"
|
||||
},
|
||||
"expr": "sum by (model) (increase({__name__=\"claude_code.token.usage\", hive=~\"$hive\", agent=~\"$agent\"}[$__range]))",
|
||||
"expr": "sort_desc(sum by (model) (increase({__name__=\"claude_code.token.usage\", hive=~\"$hive\", agent=~\"$agent\"}[$__range])))",
|
||||
"instant": true,
|
||||
"legendFormat": "{{model}}"
|
||||
}
|
||||
|
|
@ -448,7 +448,7 @@
|
|||
"type": "prometheus",
|
||||
"uid": "@datasourceUid@"
|
||||
},
|
||||
"expr": "sum by (effort) (increase({__name__=\"claude_code.cost.usage\", hive=~\"$hive\", agent=~\"$agent\"}[$__range]))",
|
||||
"expr": "sort_desc(sum by (effort) (increase({__name__=\"claude_code.cost.usage\", hive=~\"$hive\", agent=~\"$agent\"}[$__range])))",
|
||||
"instant": true,
|
||||
"legendFormat": "{{effort}}"
|
||||
}
|
||||
|
|
@ -507,7 +507,7 @@
|
|||
"type": "prometheus",
|
||||
"uid": "@datasourceUid@"
|
||||
},
|
||||
"expr": "sum by (query_source) (increase({__name__=\"claude_code.cost.usage\", hive=~\"$hive\", agent=~\"$agent\"}[$__range]))",
|
||||
"expr": "sort_desc(sum by (query_source) (increase({__name__=\"claude_code.cost.usage\", hive=~\"$hive\", agent=~\"$agent\"}[$__range])))",
|
||||
"instant": true,
|
||||
"legendFormat": "{{query_source}}"
|
||||
}
|
||||
|
|
@ -566,7 +566,7 @@
|
|||
"type": "prometheus",
|
||||
"uid": "@datasourceUid@"
|
||||
},
|
||||
"expr": "sum by (language, decision) (increase({__name__=\"claude_code.code_edit_tool.decision\", hive=~\"$hive\", agent=~\"$agent\"}[$__range]))",
|
||||
"expr": "sort_desc(sum by (language, decision) (increase({__name__=\"claude_code.code_edit_tool.decision\", hive=~\"$hive\", agent=~\"$agent\"}[$__range])))",
|
||||
"instant": true,
|
||||
"legendFormat": "{{language}} · {{decision}}"
|
||||
}
|
||||
|
|
@ -625,7 +625,7 @@
|
|||
"type": "prometheus",
|
||||
"uid": "@datasourceUid@"
|
||||
},
|
||||
"expr": "sum by (tool_name, decision) (increase({__name__=\"claude_code.code_edit_tool.decision\", hive=~\"$hive\", agent=~\"$agent\"}[$__range]))",
|
||||
"expr": "sort_desc(sum by (tool_name, decision) (increase({__name__=\"claude_code.code_edit_tool.decision\", hive=~\"$hive\", agent=~\"$agent\"}[$__range])))",
|
||||
"instant": true,
|
||||
"legendFormat": "{{tool_name}} · {{decision}}"
|
||||
}
|
||||
|
|
@ -838,7 +838,7 @@
|
|||
"type": "prometheus",
|
||||
"uid": "@datasourceUid@"
|
||||
},
|
||||
"expr": "sum by (agent) (increase({__name__=\"claude_code.active_time.total\", hive=~\"$hive\", agent=~\"$agent\"}[$__range])) / sum by (agent) (increase({__name__=\"claude_code.session.count\", hive=~\"$hive\", agent=~\"$agent\"}[$__range]))",
|
||||
"expr": "sort_desc(sum by (agent) (increase({__name__=\"claude_code.active_time.total\", hive=~\"$hive\", agent=~\"$agent\"}[$__range])) / sum by (agent) (increase({__name__=\"claude_code.session.count\", hive=~\"$hive\", agent=~\"$agent\"}[$__range])))",
|
||||
"instant": true,
|
||||
"legendFormat": "{{agent}}"
|
||||
}
|
||||
|
|
@ -897,7 +897,7 @@
|
|||
"type": "prometheus",
|
||||
"uid": "@datasourceUid@"
|
||||
},
|
||||
"expr": "sum by (agent) (increase({__name__=\"claude_code.cost.usage\", hive=~\"$hive\", agent=~\"$agent\"}[$__range]))",
|
||||
"expr": "sort_desc(sum by (agent) (increase({__name__=\"claude_code.cost.usage\", hive=~\"$hive\", agent=~\"$agent\"}[$__range])))",
|
||||
"instant": true,
|
||||
"legendFormat": "{{agent}}"
|
||||
}
|
||||
|
|
@ -956,7 +956,7 @@
|
|||
"type": "prometheus",
|
||||
"uid": "@datasourceUid@"
|
||||
},
|
||||
"expr": "sum by (agent) (increase({__name__=\"claude_code.token.usage\", hive=~\"$hive\", agent=~\"$agent\"}[$__range]))",
|
||||
"expr": "sort_desc(sum by (agent) (increase({__name__=\"claude_code.token.usage\", hive=~\"$hive\", agent=~\"$agent\"}[$__range])))",
|
||||
"instant": true,
|
||||
"legendFormat": "{{agent}}"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue