mattermost-community-enterp.../build/docker/grafana/dashboards/mattermost/mattermost-agents-tokens.json

1151 lines
40 KiB
JSON

{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"description": "Total tokens consumed across all bots, teams, and users",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "yellow",
"value": 1000000
},
{
"color": "red",
"value": 10000000
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 6,
"x": 0,
"y": 0
},
"id": 1,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"values": false,
"calcs": [
"lastNotNull"
],
"fields": ""
},
"textMode": "auto"
},
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"editorMode": "code",
"expr": "sum(agents_llm_input_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"}) + sum(agents_llm_output_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"})",
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "Total Tokens Consumed",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"description": "Total input tokens consumed",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "blue",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 6,
"x": 6,
"y": 0
},
"id": 2,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"values": false,
"calcs": [
"lastNotNull"
],
"fields": ""
},
"textMode": "auto"
},
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"editorMode": "code",
"expr": "sum(agents_llm_input_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"})",
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "Total Input Tokens",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"description": "Total output tokens consumed",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "purple",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 6,
"x": 12,
"y": 0
},
"id": 3,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"values": false,
"calcs": [
"lastNotNull"
],
"fields": ""
},
"textMode": "auto"
},
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"editorMode": "code",
"expr": "sum(agents_llm_output_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"})",
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "Total Output Tokens",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"description": "Estimated cost based on typical LLM pricing (adjust calculation for your actual rates)",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "yellow",
"value": 100
},
{
"color": "red",
"value": 500
}
]
},
"unit": "currencyUSD"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 6,
"x": 18,
"y": 0
},
"id": 4,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"values": false,
"calcs": [
"lastNotNull"
],
"fields": ""
},
"textMode": "auto"
},
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"editorMode": "code",
"expr": "(sum(agents_llm_input_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"}) * 0.003 / 1000) + (sum(agents_llm_output_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"}) * 0.015 / 1000)",
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "Estimated Cost (Input: $0.003/1K, Output: $0.015/1K)",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"description": "Token consumption over time",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"tooltip": false,
"viz": false,
"legend": false
},
"lineInterpolation": "linear",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Input Tokens"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "blue",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "Output Tokens"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "purple",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 10,
"w": 24,
"x": 0,
"y": 8
},
"id": 5,
"options": {
"legend": {
"calcs": [
"last",
"mean"
],
"displayMode": "table",
"placement": "right",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"editorMode": "code",
"expr": "sum(increase(agents_llm_input_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"}[$__interval])) or sum(agents_llm_input_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"})",
"legendFormat": "Input Tokens",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"editorMode": "code",
"expr": "sum(increase(agents_llm_output_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"}[$__interval])) or sum(agents_llm_output_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"})",
"legendFormat": "Output Tokens",
"range": true,
"refId": "B"
}
],
"title": "Token Consumption Over Time",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"description": "Token consumption by bot",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"tooltip": false,
"viz": false,
"legend": false
},
"lineInterpolation": "linear",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "normal"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 12,
"x": 0,
"y": 18
},
"id": 6,
"options": {
"legend": {
"calcs": [
"last",
"sum"
],
"displayMode": "table",
"placement": "right",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"editorMode": "code",
"expr": "sum by (bot_name) (increase(agents_llm_input_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"}[$__interval]) + increase(agents_llm_output_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"}[$__interval])) or sum by (bot_name) (agents_llm_input_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"} + agents_llm_output_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"})",
"legendFormat": "{{bot_name}}",
"range": true,
"refId": "A"
}
],
"title": "Token Usage by Bot",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"description": "Token consumption by team",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"tooltip": false,
"viz": false,
"legend": false
},
"lineInterpolation": "linear",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "normal"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 12,
"x": 12,
"y": 18
},
"id": 7,
"options": {
"legend": {
"calcs": [
"last",
"sum"
],
"displayMode": "table",
"placement": "right",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"editorMode": "code",
"expr": "sum by (team_id) (increase(agents_llm_input_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"}[$__interval]) + increase(agents_llm_output_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"}[$__interval])) or sum by (team_id) (agents_llm_input_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"} + agents_llm_output_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"})",
"legendFormat": "{{team_id}}",
"range": true,
"refId": "A"
}
],
"title": "Token Usage by Team",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"description": "Top bots by total token consumption",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Total Tokens"
},
"properties": [
{
"id": "custom.width",
"value": 150
}
]
},
{
"matcher": {
"id": "byName",
"options": "Estimated Cost"
},
"properties": [
{
"id": "unit",
"value": "currencyUSD"
},
{
"id": "custom.width",
"value": 150
}
]
}
]
},
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 28
},
"id": 8,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Total Tokens"
}
]
},
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"editorMode": "code",
"expr": "sum by (bot_name) (agents_llm_input_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"} + agents_llm_output_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"})",
"format": "table",
"instant": true,
"legendFormat": "__auto",
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"editorMode": "code",
"expr": "sum by (bot_name) ((agents_llm_input_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"} * 0.003 / 1000) + (agents_llm_output_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"} * 0.015 / 1000))",
"format": "table",
"hide": false,
"instant": true,
"legendFormat": "__auto",
"refId": "B"
}
],
"title": "Top Bots by Token Usage",
"transformations": [
{
"id": "merge",
"options": {}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true
},
"indexByName": {
"Time": 0,
"Value #A": 2,
"Value #B": 3,
"bot_name": 1
},
"renameByName": {
"Value #A": "Total Tokens",
"Value #B": "Estimated Cost",
"bot_name": "Bot Name"
}
}
}
],
"type": "table"
},
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"description": "Top teams by total token consumption",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Total Tokens"
},
"properties": [
{
"id": "custom.width",
"value": 150
}
]
},
{
"matcher": {
"id": "byName",
"options": "Estimated Cost"
},
"properties": [
{
"id": "unit",
"value": "currencyUSD"
},
{
"id": "custom.width",
"value": 150
}
]
}
]
},
"gridPos": {
"h": 9,
"w": 12,
"x": 12,
"y": 28
},
"id": 9,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Total Tokens"
}
]
},
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"editorMode": "code",
"expr": "sum by (team_id) (agents_llm_input_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"} + agents_llm_output_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"})",
"format": "table",
"instant": true,
"legendFormat": "__auto",
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"editorMode": "code",
"expr": "sum by (team_id) ((agents_llm_input_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"} * 0.003 / 1000) + (agents_llm_output_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"} * 0.015 / 1000))",
"format": "table",
"hide": false,
"instant": true,
"legendFormat": "__auto",
"refId": "B"
}
],
"title": "Top Teams by Token Usage",
"transformations": [
{
"id": "merge",
"options": {}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true
},
"indexByName": {
"Time": 0,
"Value #A": 2,
"Value #B": 3,
"team_id": 1
},
"renameByName": {
"Value #A": "Total Tokens",
"Value #B": "Estimated Cost",
"team_id": "Team ID"
}
}
}
],
"type": "table"
},
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"description": "Breakdown of input vs output tokens as percentages",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"hideFrom": {
"tooltip": false,
"viz": false,
"legend": false
}
},
"mappings": [],
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 8,
"x": 0,
"y": 46
},
"id": 11,
"options": {
"legend": {
"displayMode": "table",
"placement": "right",
"showLegend": true,
"values": [
"value",
"percent"
]
},
"pieType": "donut",
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"editorMode": "code",
"expr": "sum(agents_llm_input_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"})",
"legendFormat": "Input Tokens",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"editorMode": "code",
"expr": "sum(agents_llm_output_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"})",
"legendFormat": "Output Tokens",
"range": true,
"refId": "B"
}
],
"title": "Input vs Output Token Distribution",
"type": "piechart"
},
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"description": "Estimated daily cost trend",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 20,
"gradientMode": "opacity",
"hideFrom": {
"tooltip": false,
"viz": false,
"legend": false
},
"lineInterpolation": "smooth",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "currencyUSD"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 16,
"x": 8,
"y": 46
},
"id": 12,
"options": {
"legend": {
"calcs": [
"mean",
"last"
],
"displayMode": "table",
"placement": "right",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "10.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"editorMode": "code",
"expr": "sum(increase(agents_llm_input_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"}[1d]) * 0.003 / 1000 + increase(agents_llm_output_tokens_total{bot_name=~\"$bot_name\",team_id=~\"$team_id\"}[1d]) * 0.015 / 1000)",
"legendFormat": "Daily Cost",
"range": true,
"refId": "A"
}
],
"title": "Estimated Daily Cost Trend",
"type": "timeseries"
}
],
"refresh": "30s",
"schemaVersion": 38,
"style": "dark",
"tags": [
"llm",
"ai",
"tokens",
"mattermost",
"agents"
],
"templating": {
"list": [
{
"allValue": ".*",
"current": {
"selected": false,
"text": "All",
"value": "$__all"
},
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"definition": "label_values(agents_llm_input_tokens_total, bot_name)",
"hide": 0,
"includeAll": true,
"label": "Bot",
"multi": true,
"name": "bot_name",
"options": [],
"query": {
"query": "label_values(agents_llm_input_tokens_total, bot_name)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"type": "query"
},
{
"allValue": ".*",
"current": {
"selected": false,
"text": "All",
"value": "$__all"
},
"datasource": {
"type": "prometheus",
"uid": "Prometheus"
},
"definition": "label_values(agents_llm_input_tokens_total, team_id)",
"hide": 0,
"includeAll": true,
"label": "Team",
"multi": true,
"name": "team_id",
"options": [],
"query": {
"query": "label_values(agents_llm_input_tokens_total, team_id)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"type": "query"
}
]
},
"time": {
"from": "now-24h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Mattermost AI Agents - LLM Token Usage",
"uid": "mattermost-ai-tokens",
"version": 1,
"weekStart": ""
}