From 45b856b97ed7d032f9ca4a16dbcd5df3094d146c Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Sun, 22 Dec 2024 15:53:39 +0000 Subject: [PATCH] feat(grafana): postgres connection panel, db performance tracking dashboard (#6081) Co-authored-by: Dotan Simha --- .../grafana-dashboards/Hive-Vitals.json | 160 +++++++++ .../Performance-Traces.json | 307 ++++++++++++++++++ 2 files changed, 467 insertions(+) create mode 100644 deployment/grafana-dashboards/Performance-Traces.json diff --git a/deployment/grafana-dashboards/Hive-Vitals.json b/deployment/grafana-dashboards/Hive-Vitals.json index b8892097f8..2ada1f84d7 100644 --- a/deployment/grafana-dashboards/Hive-Vitals.json +++ b/deployment/grafana-dashboards/Hive-Vitals.json @@ -361,6 +361,166 @@ "title": "Postgres Overview", "type": "timeseries" }, + { + "datasource": { + "uid": "$Subscription" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "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": 6, + "x": 6, + "y": 7 + }, + "id": 76, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.4.0-79828", + "targets": [ + { + "azureMonitor": { + "aggregation": "Maximum", + "alias": "Max", + "allowedTimeGrainsMs": [1800000, 3600000, 21600000, 43200000, 86400000], + "dimensionFilters": [], + "metricName": "max_connections", + "customNamespace": "microsoft.dbforpostgresql/flexibleservers", + "metricNamespace": "microsoft.dbforpostgresql/flexibleservers", + "resources": [ + { + "resourceGroup": "AZURE_POSTGRES_RESOURCE_GROUP", + "resourceName": "AZURE_POSTGRES_SERVER_NAME" + } + ], + "timeGrain": "auto" + }, + "datasource": { + "uid": "$Subscription" + }, + "queryType": "Azure Monitor", + "refId": "A", + "subscription": "AZURE_SUBSCRIPTION_ID" + }, + { + "azureMonitor": { + "aggregation": "Maximum", + "alias": "Active", + "allowedTimeGrainsMs": [1800000, 3600000, 21600000, 43200000, 86400000], + "dimensionFilters": [], + "metricName": "active_connections", + "customNamespace": "microsoft.dbforpostgresql/flexibleservers", + "metricNamespace": "microsoft.dbforpostgresql/flexibleservers", + "resources": [ + { + "resourceGroup": "AZURE_POSTGRES_RESOURCE_GROUP", + "resourceName": "AZURE_POSTGRES_SERVER_NAME" + } + ], + "timeGrain": "auto" + }, + "datasource": { + "uid": "$Subscription" + }, + "hide": false, + "queryType": "Azure Monitor", + "refId": "B", + "subscription": "AZURE_SUBSCRIPTION_ID" + }, + { + "azureMonitor": { + "aggregation": "Maximum", + "alias": "Waiting", + "allowedTimeGrainsMs": [ + 60000, 300000, 900000, 1800000, 3600000, 21600000, 43200000, 86400000 + ], + "dimensionFilters": [], + "metricName": "client_connections_waiting", + "customNamespace": "microsoft.dbforpostgresql/flexibleservers", + "metricNamespace": "microsoft.dbforpostgresql/flexibleservers", + "resources": [ + { + "resourceGroup": "AZURE_POSTGRES_RESOURCE_GROUP", + "resourceName": "AZURE_POSTGRES_SERVER_NAME" + } + ], + "timeGrain": "auto" + }, + "datasource": { + "uid": "$Subscription" + }, + "hide": false, + "queryType": "Azure Monitor", + "refId": "C", + "subscription": "AZURE_SUBSCRIPTION_ID" + } + ], + "title": "Postgres Connections", + "type": "timeseries" + }, { "datasource": { "uid": "$Subscription" diff --git a/deployment/grafana-dashboards/Performance-Traces.json b/deployment/grafana-dashboards/Performance-Traces.json new file mode 100644 index 0000000000..1363dc60fc --- /dev/null +++ b/deployment/grafana-dashboards/Performance-Traces.json @@ -0,0 +1,307 @@ +{ + "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" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 1000, + "links": [], + "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 3, + "panels": [], + "title": "Clickhouse Performance", + "type": "row" + }, + { + "datasource": { + "type": "tempo", + "uid": "grafanacloud-traces" + }, + "description": "A list of requests that included a slow Clickhouse query", + "fieldConfig": { + "defaults": { + "color": { + "mode": "fixed" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Service" + }, + "properties": [ + { + "id": "custom.hidden" + } + ] + } + ] + }, + "gridPos": { + "h": 14, + "w": 24, + "x": 0, + "y": 1 + }, + "id": 4, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": ["sum"], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "datasource": { + "type": "tempo", + "uid": "grafanacloud-traces" + }, + "filters": [ + { + "id": "9d055a7f", + "operator": "=", + "scope": "span" + } + ], + "limit": 100, + "query": "{name=~\"ClickHouse: .*\" && duration>${clickhouseThreshold}}", + "queryType": "traceql", + "refId": "A", + "spss": 20, + "tableType": "traces" + } + ], + "title": "Slow Clickhouse Queries", + "type": "table" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 15 + }, + "id": 2, + "panels": [ + { + "datasource": { + "type": "tempo", + "uid": "grafanacloud-traces" + }, + "description": "A list of requests that included a slow Postgres query", + "fieldConfig": { + "defaults": { + "color": { + "mode": "fixed" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Service" + }, + "properties": [ + { + "id": "custom.hidden" + } + ] + } + ] + }, + "gridPos": { + "h": 12, + "w": 24, + "x": 0, + "y": 16 + }, + "id": 1, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": ["sum"], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "11.5.0-80207", + "targets": [ + { + "datasource": { + "type": "tempo", + "uid": "grafanacloud-traces" + }, + "filters": [ + { + "id": "9d055a7f", + "operator": "=", + "scope": "span" + } + ], + "limit": 100, + "query": "{name=~\"PG: .*\" && duration>${postgresThreshold}}", + "queryType": "traceql", + "refId": "A", + "spss": 20, + "tableType": "traces" + } + ], + "title": "Slow Postgres Queries", + "type": "table" + } + ], + "title": "Postgres Performance", + "type": "row" + } + ], + "preload": false, + "schemaVersion": 40, + "tags": [], + "templating": { + "list": [ + { + "allowCustomValue": true, + "current": { + "text": "3000ms", + "value": "3000ms" + }, + "description": "", + "label": "Postgres Threshold", + "name": "postgresThreshold", + "options": [ + { + "selected": true, + "text": "3000ms", + "value": "3000ms" + }, + { + "selected": false, + "text": "5000ms", + "value": "5000ms" + }, + { + "selected": false, + "text": "10000ms", + "value": "10000ms" + } + ], + "query": "3000ms,5000ms,10000ms", + "type": "custom" + }, + { + "allowCustomValue": true, + "current": { + "text": "3000ms", + "value": "3000ms" + }, + "description": "", + "label": "Clickhouse Threshold", + "name": "clickhouseThreshold", + "options": [ + { + "selected": false, + "text": "1000ms", + "value": "1000ms" + }, + { + "selected": true, + "text": "3000ms", + "value": "3000ms" + }, + { + "selected": false, + "text": "5000ms", + "value": "5000ms" + }, + { + "selected": false, + "text": "10000ms", + "value": "10000ms" + } + ], + "query": "1000ms,3000ms,5000ms,10000ms", + "type": "custom" + } + ] + }, + "time": { + "from": "now-1d", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "Performance Traces", + "uid": "ce7p5rel7zrb4c", + "version": 1, + "weekStart": "" +}