Skip to content

Instantly share code, notes, and snippets.

@dalf
Last active February 25, 2024 21:51
Show Gist options
  • Save dalf/0931ea033a3c6162617b762c2ac0e65e to your computer and use it in GitHub Desktop.
Save dalf/0931ea033a3c6162617b762c2ac0e65e to your computer and use it in GitHub Desktop.
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"description": "",
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 30,
"iteration": 1708893688917,
"links": [],
"liveNow": true,
"panels": [
{
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisGridShow": true,
"axisLabel": "",
"axisPlacement": "left",
"axisWidth": 70,
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "smooth",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"log": 2,
"type": "log"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "s"
},
"overrides": []
},
"gridPos": {
"h": 11,
"w": 16,
"x": 0,
"y": 0
},
"id": 6,
"interval": "1m",
"links": [],
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "10.1.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "U2t9QZnIz"
},
"exemplar": true,
"expr": "rate(http_request_duration_seconds_sum{handler!=\"none\", instance=\"$instance\"}[1m]) / rate(http_request_duration_seconds_count{handler!=\"none\", instance=\"$instance\"}[1m])",
"interval": "",
"legendFormat": "{{ method }} {{ handler }}",
"refId": "A"
}
],
"title": "Average response time",
"type": "timeseries"
},
{
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"displayMode": "auto",
"filterable": false
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "s"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "instance"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
},
{
"matcher": {
"id": "byName",
"options": "job"
},
"properties": [
{
"id": "custom.hidden",
"value": true
}
]
},
{
"matcher": {
"id": "byName",
"options": "method"
},
"properties": [
{
"id": "custom.width",
"value": 70
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value (mean)"
},
"properties": [
{
"id": "custom.width",
"value": 70
},
{
"id": "displayName",
"value": "Mean"
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value (max)"
},
"properties": [
{
"id": "custom.width",
"value": 70
},
{
"id": "displayName",
"value": "Max"
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value (sum)"
},
"properties": [
{
"id": "custom.width",
"value": 70
},
{
"id": "displayName",
"value": "Sum"
}
]
},
{
"matcher": {
"id": "byName",
"options": "handler"
},
"properties": [
{
"id": "custom.width",
"value": 227
}
]
},
{
"matcher": {
"id": "byName",
"options": "Sum"
},
"properties": [
{
"id": "custom.width",
"value": 94
}
]
}
]
},
"gridPos": {
"h": 11,
"w": 8,
"x": 16,
"y": 0
},
"id": 20,
"interval": "1m",
"links": [],
"options": {
"footer": {
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": []
},
"pluginVersion": "8.4.10",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "U2t9QZnIz"
},
"exemplar": true,
"expr": "rate(http_request_duration_seconds_sum{handler!=\"none\", instance=\"$instance\"}[1m]) / rate(http_request_duration_seconds_count{handler!=\"none\", instance=\"$instance\"}[1m])",
"format": "table",
"interval": "",
"intervalFactor": 1,
"legendFormat": "{{ method }} {{ handler }}",
"refId": "A"
}
],
"title": "Average response time for the selected time range",
"transformations": [
{
"id": "filterByValue",
"options": {
"filters": [
{
"config": {
"id": "greater",
"options": {
"value": -1
}
},
"fieldName": "Value"
}
],
"match": "any",
"type": "include"
}
},
{
"id": "groupBy",
"options": {
"fields": {
"Time": {
"aggregations": []
},
"Value": {
"aggregations": [
"mean",
"max",
"sum"
],
"operation": "aggregate"
},
"handler": {
"aggregations": [],
"operation": "groupby"
},
"instance": {
"aggregations": [],
"operation": "groupby"
},
"job": {
"aggregations": [],
"operation": "groupby"
},
"method": {
"aggregations": [],
"operation": "groupby"
}
}
}
},
{
"id": "organize",
"options": {
"excludeByName": {},
"indexByName": {
"Value (max)": 5,
"Value (mean)": 4,
"Value (sum)": 6,
"handler": 3,
"instance": 0,
"job": 1,
"method": 2
},
"renameByName": {}
}
}
],
"type": "table"
},
{
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisGridShow": true,
"axisLabel": "",
"axisPlacement": "auto",
"axisWidth": 70,
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 16,
"x": 0,
"y": 11
},
"id": 2,
"interval": "1m",
"links": [],
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "10.1.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "U2t9QZnIz"
},
"exemplar": true,
"expr": "increase(http_requests_total{handler!=\"none\", instance=\"$instance\", status=\"2xx\"}[1m])",
"interval": "",
"legendFormat": "{{method}} {{handler}}",
"refId": "A"
}
],
"title": "Requests per endpoint (HTTP status 2xx)",
"type": "timeseries"
},
{
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"displayMode": "color-text",
"filterable": true
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "text",
"value": null
}
]
},
"unit": "none"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "method"
},
"properties": [
{
"id": "custom.width",
"value": 74
}
]
},
{
"matcher": {
"id": "byName",
"options": "handler"
},
"properties": [
{
"id": "custom.width",
"value": 226
}
]
},
{
"matcher": {
"id": "byName",
"options": "status"
},
"properties": [
{
"id": "custom.width",
"value": 74
},
{
"id": "mappings",
"value": [
{
"options": {
"2xx": {
"color": "#ccccdb5c",
"index": 0
},
"4xx": {
"color": "semi-dark-orange",
"index": 1
},
"5xx": {
"color": "semi-dark-red",
"index": 2
}
},
"type": "value"
}
]
}
]
},
{
"matcher": {
"id": "byName",
"options": "Request count"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "text",
"mode": "fixed"
}
},
{
"id": "custom.width",
"value": 161
}
]
}
]
},
"gridPos": {
"h": 12,
"w": 8,
"x": 16,
"y": 11
},
"id": 21,
"interval": "1m",
"links": [],
"options": {
"footer": {
"fields": "",
"reducer": [
"sum"
],
"show": true
},
"showHeader": true,
"sortBy": []
},
"pluginVersion": "8.4.10",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "U2t9QZnIz"
},
"exemplar": true,
"expr": "increase(http_requests_total{handler!=\"none\", instance=\"$instance\"}[1m])",
"format": "table",
"instant": false,
"interval": "",
"legendFormat": "{{method}} {{handler}}",
"refId": "A"
}
],
"title": "Requests count for the selected time range",
"transformations": [
{
"id": "filterByValue",
"options": {
"filters": [
{
"config": {
"id": "greater",
"options": {
"value": 0
}
},
"fieldName": "Value"
}
],
"match": "any",
"type": "include"
}
},
{
"id": "groupBy",
"options": {
"fields": {
"Value": {
"aggregations": [
"count"
],
"operation": "aggregate"
},
"handler": {
"aggregations": [],
"operation": "groupby"
},
"instance": {
"aggregations": [],
"operation": "groupby"
},
"job": {
"aggregations": [],
"operation": "groupby"
},
"method": {
"aggregations": [],
"operation": "groupby"
},
"status": {
"aggregations": [],
"operation": "groupby"
}
}
}
},
{
"id": "organize",
"options": {
"excludeByName": {
"instance": true,
"job": true
},
"indexByName": {
"Value (count)": 5,
"handler": 1,
"instance": 2,
"job": 3,
"method": 0,
"status": 4
},
"renameByName": {
"Value (count)": "Request count",
"job": ""
}
}
}
],
"type": "table"
},
{
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisGridShow": true,
"axisLabel": "",
"axisPlacement": "auto",
"axisWidth": 70,
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 9,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 16,
"x": 0,
"y": 21
},
"id": 22,
"interval": "1m",
"links": [],
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "10.1.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "U2t9QZnIz"
},
"exemplar": true,
"expr": "increase(http_requests_total{handler!=\"none\", instance=\"$instance\", status=~\"4xx|5xx\"}[1m])",
"interval": "",
"legendFormat": "{{method}} {{handler}} - {{status}}",
"refId": "A"
}
],
"title": "Errors per endpoint (HTTP status 4xx or 5xx)",
"transformations": [],
"transparent": true,
"type": "timeseries"
},
{
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"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
},
{
"color": "red",
"value": 80
}
]
},
"unit": "decbytes"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 8,
"x": 16,
"y": 23
},
"id": 8,
"links": [],
"options": {
"legend": {
"calcs": [
"lastNotNull"
],
"displayMode": "hidden",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "10.1.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "U2t9QZnIz"
},
"exemplar": true,
"expr": "process_resident_memory_bytes{job=\"fastapi\", instance=\"$instance\"}",
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"title": "Memory usage",
"type": "timeseries"
},
{
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisGridShow": true,
"axisLabel": "",
"axisPlacement": "auto",
"axisWidth": 70,
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"log": 2,
"type": "log"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "line+area"
}
},
"mappings": [],
"min": 1024,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "transparent",
"value": null
}
]
},
"unit": "bytes"
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 16,
"x": 0,
"y": 31
},
"id": 16,
"interval": "1m",
"links": [],
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "asc"
}
},
"pluginVersion": "10.1.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "U2t9QZnIz"
},
"exemplar": true,
"expr": "rate(http_response_size_bytes_sum{handler!=\"none\", instance=\"$instance\"}[1m])/rate(http_response_size_bytes_count{handler!=\"none\", instance=\"$instance\"}[1m])",
"interval": "",
"intervalFactor": 1,
"legendFormat": "{{ handler }}",
"refId": "A"
}
],
"title": "Response size per endpoint (before compression)",
"type": "timeseries"
},
{
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"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
},
{
"color": "red",
"value": 80
}
]
},
"unit": "percentunit"
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 8,
"x": 16,
"y": 31
},
"id": 9,
"interval": "1m",
"links": [],
"options": {
"legend": {
"calcs": [
"lastNotNull",
"max"
],
"displayMode": "hidden",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "10.1.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "U2t9QZnIz"
},
"exemplar": true,
"expr": "rate(process_cpu_seconds_total{job=\"fastapi\", instance=\"$instance\"}[1m])",
"interval": "",
"legendFormat": "cpu",
"refId": "A"
}
],
"title": "CPU usage",
"type": "timeseries"
},
{
"description": "Should remain to zero",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "bars",
"fillOpacity": 13,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"log": 2,
"type": "log"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "normal"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "5xx"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "dark-red",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 10,
"w": 8,
"x": 8,
"y": 41
},
"id": 18,
"interval": "1m",
"links": [],
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "10.1.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "U2t9QZnIz"
},
"exemplar": true,
"expr": "rate(python_gc_objects_uncollectable_total{instance=\"$instance\"}[1m])",
"interval": "",
"legendFormat": "generation {{ generation }}",
"refId": "A"
}
],
"title": "Uncollectable objects found during GC",
"type": "timeseries"
},
{
"description": "The value should never reach zero. It is decreasing if some files are not closed.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"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
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 8,
"x": 16,
"y": 41
},
"id": 17,
"interval": "1m",
"links": [],
"options": {
"legend": {
"calcs": [
"mean"
],
"displayMode": "hidden",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "10.1.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "U2t9QZnIz"
},
"exemplar": true,
"expr": "process_max_fds{instance=\"$instance\"} - process_open_fds{instance=\"$instance\"}",
"interval": "",
"legendFormat": "Open file descriptor",
"refId": "A"
}
],
"title": "Remaining file descriptors",
"type": "timeseries"
}
],
"refresh": false,
"schemaVersion": 35,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"current": {
"selected": true,
"text": "sibils-api.lan.text-analytics.ch:8888",
"value": "sibils-api.lan.text-analytics.ch:8888"
},
"definition": "label_values(http_requests_total, instance)",
"hide": 0,
"includeAll": false,
"label": "Application",
"multi": false,
"name": "instance",
"options": [],
"query": {
"query": "label_values(http_requests_total, instance)",
"refId": "StandardVariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"type": "query"
}
]
},
"time": {
"from": "2024-02-25T16:50:34.578Z",
"to": "2024-02-25T19:44:37.553Z"
},
"timepicker": {
"hidden": false,
"nowDelay": "0m",
"refresh_intervals": [
"30s"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "",
"title": "FastAPI",
"uid": "_eX4mpl3",
"version": 57,
"weekStart": ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment