Browse Source

dashboards

main
Nicolas Massé 1 year ago
parent
commit
406b83877f
  1. 1059
      grafana/leaderboard-explanation.json
  2. 0
      grafana/leaderboard.json
  3. 345
      grafana/lifetime-bonus.json
  4. 445
      grafana/onetime-bonus.json
  5. 8
      prometheus/recording_rules.yaml.template

1059
grafana/leaderboard-explanation.json

File diff suppressed because it is too large

0
dashboard.json → grafana/leaderboard.json

345
grafana/lifetime-bonus.json

@ -0,0 +1,345 @@
{
"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": 3,
"links": [],
"panels": [
{
"datasource": {
"default": true,
"type": "prometheus",
"uid": "be0j8k9s522v4b"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "blue",
"mode": "fixed"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"axisSoftMax": 1,
"axisSoftMin": 0,
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 16,
"x": 0,
"y": 0
},
"id": 1,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "be0j8k9s522v4b"
},
"editorMode": "code",
"exemplar": false,
"expr": "opencodequest_leaderboard_hero:prod{user=\"catwoman\"}",
"instant": false,
"interval": "5s",
"legendFormat": "{{user}}",
"range": true,
"refId": "A"
}
],
"title": "opencodequest_leaderboard_hero:prod => Exercise completion state",
"type": "timeseries"
},
{
"datasource": {
"default": true,
"type": "prometheus",
"uid": "be0j8k9s522v4b"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "blue",
"mode": "fixed"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"axisSoftMax": 80,
"axisSoftMin": 0,
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 16,
"x": 0,
"y": 6
},
"id": 4,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "be0j8k9s522v4b"
},
"editorMode": "code",
"expr": "(increase(opencodequest_leaderboard_hero:prod[10s]) >= bool 0.5)\n*\n(\n 55\n +\n sum(\n (\n 1728651786 + 55\n -\n timestamp(\n label_replace(up{instance=\"localhost:9090\"}, \"user\", \"catwoman\", \"\",\"\")\n )\n ) / 5\n ) by (user)\n)\n",
"instant": false,
"interval": "5s",
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "opencodequest_leaderboard_hero_onetime_bonus:prod => Time bonus for the user",
"type": "timeseries"
},
{
"datasource": {
"default": true,
"type": "prometheus",
"uid": "be0j8k9s522v4b"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "blue",
"mode": "fixed"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"axisSoftMax": 80,
"axisSoftMin": 0,
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 16,
"x": 0,
"y": 16
},
"id": 3,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "be0j8k9s522v4b"
},
"editorMode": "code",
"expr": "sum_over_time(opencodequest_leaderboard_hero_onetime_bonus:prod{user=\"catwoman\"}[1h])",
"instant": false,
"interval": "5s",
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "opencodequest_leaderboard_hero_lifetime_bonus:prod => Time bonus for the user (carry forward)",
"type": "timeseries"
}
],
"refresh": "",
"schemaVersion": 39,
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "2024-10-11T13:03:20.000Z",
"to": "2024-10-11T13:06:20.000Z"
},
"timepicker": {},
"timezone": "browser",
"title": "Time Bonus (carry forward)",
"uid": "fe0juqdi9f3eoc",
"version": 9,
"weekStart": ""
}

445
grafana/onetime-bonus.json

@ -0,0 +1,445 @@
{
"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": 4,
"links": [],
"panels": [
{
"datasource": {
"default": true,
"type": "prometheus",
"uid": "be0j8k9s522v4b"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "blue",
"mode": "fixed"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"axisSoftMax": 1,
"axisSoftMin": 0,
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 16,
"x": 0,
"y": 0
},
"id": 1,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "be0j8k9s522v4b"
},
"editorMode": "code",
"exemplar": false,
"expr": "opencodequest_leaderboard_hero:prod{user=\"catwoman\"}",
"instant": false,
"interval": "5s",
"legendFormat": "{{user}}",
"range": true,
"refId": "A"
}
],
"title": "opencodequest_leaderboard_hero:prod => Exercise completion state",
"type": "timeseries"
},
{
"datasource": {
"default": true,
"type": "prometheus",
"uid": "be0j8k9s522v4b"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "blue",
"mode": "fixed"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"axisSoftMax": 1,
"axisSoftMin": 0,
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 16,
"x": 0,
"y": 6
},
"id": 2,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "be0j8k9s522v4b"
},
"editorMode": "code",
"expr": "increase(opencodequest_leaderboard_hero:prod{user=\"catwoman\"}[10s]) >= bool 0.5",
"instant": false,
"interval": "5s",
"legendFormat": "{{user}}",
"range": true,
"refId": "A"
}
],
"title": "increase(opencodequest_leaderboard_hero:prod[10s]) >= bool 0.5 => Change of exercise completion stage",
"type": "timeseries"
},
{
"datasource": {
"default": true,
"type": "prometheus",
"uid": "be0j8k9s522v4b"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "blue",
"mode": "fixed"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"axisSoftMax": 80,
"axisSoftMin": 0,
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 16,
"x": 0,
"y": 12
},
"id": 3,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "be0j8k9s522v4b"
},
"editorMode": "code",
"expr": "55\n+\nsum(\n (\n 1728651786 + 55\n -\n timestamp(\n label_replace(up{instance=\"localhost:9090\"}, \"user\", \"catwoman\", \"\",\"\")\n )\n ) / 5\n ) by (user)\n",
"instant": false,
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "55 + sum(($TS - timestamp(...) / 5) by (user) => Evolution of the time bonus over time",
"type": "timeseries"
},
{
"datasource": {
"default": true,
"type": "prometheus",
"uid": "be0j8k9s522v4b"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "blue",
"mode": "fixed"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"axisSoftMax": 80,
"axisSoftMin": 0,
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 16,
"x": 0,
"y": 22
},
"id": 4,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "be0j8k9s522v4b"
},
"editorMode": "code",
"expr": "(increase(opencodequest_leaderboard_hero:prod[10s]) >= bool 0.5)\n*\n(\n 55\n +\n sum(\n (\n 1728651786 + 55\n -\n timestamp(\n label_replace(up{instance=\"localhost:9090\"}, \"user\", \"catwoman\", \"\",\"\")\n )\n ) / 5\n ) by (user)\n)\n",
"instant": false,
"interval": "5s",
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "opencodequest_leaderboard_hero_onetime_bonus:prod => Time bonus for the user",
"type": "timeseries"
}
],
"refresh": "",
"schemaVersion": 39,
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "2024-10-11T13:03:20.000Z",
"to": "2024-10-11T13:06:20.000Z"
},
"timepicker": {},
"timezone": "browser",
"title": "Time Bonus",
"uid": "51b77993344ca55e",
"version": 1,
"weekStart": ""
}

8
prometheus/recording_rules.yaml.template

@ -72,7 +72,6 @@ groups:
timestamp(label_replace(up{instance="localhost:9090"}, "user", "batman", "","")) >= bool ${TS_USER_BATMAN_FIGHT_CALL} timestamp(label_replace(up{instance="localhost:9090"}, "user", "batman", "","")) >= bool ${TS_USER_BATMAN_FIGHT_CALL}
) by (user) ) by (user)
- name: opencodequest_step1 - name: opencodequest_step1
#query_offset: ${OFFSET_STEP1}s
rules: rules:
- record: opencodequest_leaderboard_hero_onetime_bonus:prod - record: opencodequest_leaderboard_hero_onetime_bonus:prod
expr: | expr: |
@ -83,7 +82,7 @@ groups:
+ +
sum( sum(
( (
(${TS_EXERCISE_HERO} + ${OFFSET_STEP1}) ${TS_EXERCISE_HERO}
- -
timestamp( timestamp(
label_replace(up{instance="localhost:9090"}, "user", "superman", "","") label_replace(up{instance="localhost:9090"}, "user", "superman", "","")
@ -106,7 +105,7 @@ groups:
+ +
sum( sum(
( (
(${TS_EXERCISE_VILLAIN} + ${OFFSET_STEP1}) ${TS_EXERCISE_VILLAIN}
- -
timestamp( timestamp(
label_replace(up{instance="localhost:9090"}, "user", "superman", "","") label_replace(up{instance="localhost:9090"}, "user", "superman", "","")
@ -129,7 +128,7 @@ groups:
+ +
sum( sum(
( (
(${TS_EXERCISE_VILLAIN} + ${OFFSET_STEP1}) ${TS_EXERCISE_FIGHT}
- -
timestamp( timestamp(
label_replace(up{instance="localhost:9090"}, "user", "superman", "","") label_replace(up{instance="localhost:9090"}, "user", "superman", "","")
@ -144,7 +143,6 @@ groups:
) by (user) ) by (user)
) )
- name: opencodequest_step2 - name: opencodequest_step2
#query_offset: ${OFFSET_STEP2}s
rules: rules:
- record: opencodequest_leaderboard_hero_lifetime_bonus:prod - record: opencodequest_leaderboard_hero_lifetime_bonus:prod
expr: | expr: |

Loading…
Cancel
Save