Skip to content

Commit

Permalink
adding grafana dashboards for histogram of query durations and # quer…
Browse files Browse the repository at this point in the history
…ies / hour
  • Loading branch information
mdr223 committed Nov 10, 2023
1 parent 26c8811 commit 85fe394
Show file tree
Hide file tree
Showing 3 changed files with 273 additions and 0 deletions.
8 changes: 8 additions & 0 deletions deploy/dockerfiles/Dockerfile-grafana
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# syntax=docker/dockerfile:1

# create grafana directories
FROM grafana/grafana-enterprise:10.2.0
RUN mkdir -p /etc/grafana/provisioning/datasources
RUN mkdir -p /etc/grafana/provisioning/dashboards
RUN mkdir -p /var/lib/grafana/dashboards

# copy files into respective grafana directories
COPY deploy/grafana/datasources.yaml /etc/grafana/provisioning/datasources/
COPY deploy/grafana/dashboards.yaml /etc/grafana/provisioning/dashboards/
COPY deploy/grafana/a2rchi-default-dashboard.json /var/lib/grafana/dashboards/
256 changes: 256 additions & 0 deletions deploy/grafana/a2rchi-default-dashboard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"description": "Charts tracking A2rchi's usage.",
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 1,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "postgres",
"uid": "P44368ADAD746BC27"
},
"description": "Distribution of `msg_duration` column, which measures the total time from when the server receives the message to when it returns a response to the user.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"fillOpacity": 80,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineWidth": 1
},
"fieldMinMax": false,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 0
},
"id": 2,
"options": {
"bucketOffset": 0,
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
}
},
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "P44368ADAD746BC27"
},
"editorMode": "code",
"format": "time_series",
"rawQuery": true,
"rawSql": "SELECT server_received_msg_ts as time, extract(seconds from msg_duration) as msg_duration_seconds\nFROM timing\nWHERE server_received_msg_ts >= $__timeFrom() AND server_received_msg_ts < $__timeTo()\nORDER BY time",
"refId": "A",
"sql": {
"columns": [
{
"parameters": [
{
"name": "msg_duration",
"type": "functionParameter"
}
],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
},
"table": "timing"
}
],
"title": "A2rchi Response Time Histogram",
"type": "histogram"
},
{
"datasource": {
"type": "postgres",
"uid": "P44368ADAD746BC27"
},
"description": "Number of queries handled by A2rchi per-hour.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"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": 8,
"w": 12,
"x": 12,
"y": 0
},
"id": 1,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "P44368ADAD746BC27"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT $__timeGroupAlias(server_received_msg_ts, 1h), count(*)\nFROM timing\nWHERE $__timeFilter(server_received_msg_ts)\nGROUP BY 1\nORDER BY $__timeGroup(server_received_msg_ts, 1h)",
"refId": "A",
"sql": {
"columns": [
{
"parameters": [
{
"name": "*",
"type": "functionParameter"
}
],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
},
"table": "timing"
}
],
"title": "Queries / Hour",
"type": "timeseries"
}
],
"refresh": "",
"schemaVersion": 38,
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "A2rchi Usage",
"uid": "faf20efc-ffe5-48ae-9a26-debe655bf5a8",
"version": 1,
"weekStart": ""
}
9 changes: 9 additions & 0 deletions deploy/grafana/dashboards.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: 1

providers:
- name: A2rchi
folder: Dashboards
type: file
options:
path:
/var/lib/grafana/dashboards

0 comments on commit 85fe394

Please sign in to comment.