Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions grafana-dashboards/claude-code.json
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@
"type": "prometheus",
"uid": "prometheus"
},
"expr": "label_replace(sum by (model, type) (rate(claude_code_token_usage_tokens_total{session_id=~\"$session.*\"}[$__rate_interval])) * $__interval_ms / 1000, \"model\", \"$1\", \"model\", \"^([^[]+).*$\")",
"expr": "sum by (model, type) (label_replace(label_replace(label_replace(rate(claude_code_token_usage_tokens_total{session_id=~\"$session.*\"}[$__rate_interval]),\"model\",\"$1\",\"model\",\"^(.*)-[0-9]{8}$\"),\"model\",\"$1\",\"model\",\"^([^[]+)[[].*$\"),\"model\",\"$1\",\"model\",\"^~(.*)$\")) * $__interval_ms / 1000",
"refId": "A",
"legendFormat": "{{model}} - {{type}}"
}
Comment on lines +541 to 544

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normalization logic duplicated

Lines 541-544 inline the same three-pass label_replace normalization as the Model Comparison table and lines 585-587, so any regex tweak has to be updated in several places and can drift — should we factor it into a shared Grafana template/variable or reuse the existing expression?

Severity

Expand Down Expand Up @@ -582,7 +582,7 @@
"type": "prometheus",
"uid": "prometheus"
},
"expr": "label_replace(sum by (model) (rate(claude_code_token_usage_tokens_total{session_id=~\"$session.*\"}[$__rate_interval])) * $__interval_ms / 1000, \"model\", \"$1\", \"model\", \"^([^[]+).*$\")",
"expr": "sum by (model) (label_replace(label_replace(label_replace(rate(claude_code_token_usage_tokens_total{session_id=~\"$session.*\"}[$__rate_interval]),\"model\",\"$1\",\"model\",\"^(.*)-[0-9]{8}$\"),\"model\",\"$1\",\"model\",\"^([^[]+)[[].*$\"),\"model\",\"$1\",\"model\",\"^~(.*)$\")) * $__interval_ms / 1000",
"refId": "A",
"legendFormat": "{{model}}"
}
Expand Down
Loading