Skip to content

Commit

Permalink
feat(metrics): Count all sessions and session minutes over time range
Browse files Browse the repository at this point in the history
  • Loading branch information
MoritzWeber0 committed Dec 5, 2024
1 parent a5abcb7 commit a95e27d
Showing 1 changed file with 210 additions and 71 deletions.
281 changes: 210 additions & 71 deletions helm/config/grafana/dashboards/active-sessions.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
},
"gridPos": {
"h": 7,
"w": 9,
"w": 8,
"x": 8,
"y": 0
},
Expand Down Expand Up @@ -294,71 +294,6 @@
"title": "Active sessions per tool",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus_ccm"
},
"description": "Number of active sessions at the end of the time range.",
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "blue",
"mode": "fixed"
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 3,
"x": 0,
"y": 7
},
"id": 2,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "11.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus_ccm"
},
"editorMode": "code",
"expr": "sum(count(up{tool_version_id=~\"$tool_version_id\",connection_method_id=~\"$connection_method_id\", session_type=~\"$session_type\", job=\"sessions\"})) OR on() vector(0)",
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "Active sessions",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
Expand Down Expand Up @@ -427,8 +362,8 @@
},
"gridPos": {
"h": 6,
"w": 14,
"x": 3,
"w": 16,
"x": 0,
"y": 7
},
"id": 5,
Expand Down Expand Up @@ -486,9 +421,9 @@
},
"gridPos": {
"h": 3,
"w": 3,
"w": 4,
"x": 0,
"y": 10
"y": 13
},
"id": 7,
"options": {
Expand Down Expand Up @@ -528,6 +463,210 @@
],
"title": "Max",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus_ccm"
},
"description": "Number of active sessions at the end of the time range.",
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "blue",
"mode": "fixed"
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 4,
"x": 4,
"y": 13
},
"id": 2,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "11.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus_ccm"
},
"editorMode": "code",
"expr": "sum(count(up{tool_version_id=~\"$tool_version_id\",connection_method_id=~\"$connection_method_id\", session_type=~\"$session_type\", job=\"sessions\"})) OR on() vector(0)",
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "Active sessions",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus_ccm"
},
"description": "Sum of all session minutes.",
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "blue",
"mode": "fixed"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "m"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 4,
"x": 8,
"y": 13
},
"id": 8,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "11.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus_ccm"
},
"editorMode": "code",
"expr": "sum(count_over_time(up{tool_version_id=~\"$tool_version_id\",connection_method_id=~\"$connection_method_id\", session_type=~\"$session_type\", job=\"sessions\"}[$__range]))/2",
"instant": false,
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "Counted Session Minutes",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus_ccm"
},
"description": "Sum of unique sessions which were active in the selected range.",
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "blue",
"mode": "fixed"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 4,
"x": 12,
"y": 13
},
"id": 9,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "11.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus_ccm"
},
"editorMode": "code",
"expr": "count(count_over_time(up{tool_version_id=~\"$tool_version_id\",connection_method_id=~\"$connection_method_id\", session_type=~\"$session_type\", job=\"sessions\"}[$__range]))",
"instant": false,
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "Sum of unique sessions",
"type": "stat"
}
],
"refresh": "",
Expand Down Expand Up @@ -627,6 +766,6 @@
"timezone": "",
"title": "Active sessions",
"uid": "0kK_I7T4k",
"version": 12,
"version": 13,
"weekStart": ""
}

0 comments on commit a95e27d

Please sign in to comment.