From a36645012bb36284f381000dbcd4e14d907b359a Mon Sep 17 00:00:00 2001 From: mdr223 Date: Sun, 12 Nov 2023 22:00:24 -0500 Subject: [PATCH] added 2 more charts of interest --- deploy/grafana/a2rchi-default-dashboard.json | 284 ++++++++++++++++--- 1 file changed, 248 insertions(+), 36 deletions(-) diff --git a/deploy/grafana/a2rchi-default-dashboard.json b/deploy/grafana/a2rchi-default-dashboard.json index e0b5f8f..8343859 100644 --- a/deploy/grafana/a2rchi-default-dashboard.json +++ b/deploy/grafana/a2rchi-default-dashboard.json @@ -19,10 +19,128 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 5, "links": [], "liveNow": false, "panels": [ + { + "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": 40, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "noValue": "0", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "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": "-- number of messages per 15min window\nWITH msg_timing_info AS (\n SELECT $__timeGroup(server_received_msg_ts, '1h', 0) as t1, count(mid) as num_msgs\n FROM timing\n WHERE $__timeFrom() <= server_received_msg_ts AND server_received_msg_ts <= $__timeTo()\n GROUP BY 1\n ORDER BY $__timeGroup(server_received_msg_ts, '1h', 0)\n), convo_timing_info AS ( -- number of unique conversations per 15 min window\n SELECT $__timeGroup(server_received_msg_ts, '1h', 0) as t2, count(distinct(conversation_id)) as num_convos\n FROM timing JOIN conversations ON timing.mid = conversations.message_id\n WHERE $__timeFrom() <= server_received_msg_ts AND server_received_msg_ts <= $__timeTo()\n GROUP BY 1\n ORDER BY $__timeGroup(server_received_msg_ts, '1h', 0)\n), intervals AS (\n SELECT $__timeGroupAlias(t, '1h', 0) FROM generate_series($__timeFrom(), $__timeTo(), '1 hour'::interval) AS s(t)\n), msgs_join_convos AS (\n SELECT * FROM msg_timing_info JOIN convo_timing_info ON t1 = t2\n)\nSELECT time, num_msgs, num_convos as interval FROM intervals LEFT OUTER JOIN msgs_join_convos ON t1 = intervals.time;\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "*", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "timing" + } + ], + "title": "Number of Messages and Distinct Conversations", + "type": "timeseries" + }, { "datasource": { "type": "postgres", @@ -66,7 +184,7 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, + "x": 12, "y": 0 }, "id": 2, @@ -123,10 +241,11 @@ "type": "postgres", "uid": "P44368ADAD746BC27" }, - "description": "Number of queries handled by A2rchi per-hour.", + "description": "Bar chart tracking the feedback totals.", "fieldConfig": { "defaults": { "color": { + "fixedColor": "green", "mode": "palette-classic" }, "custom": { @@ -135,34 +254,136 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 40, + "fillOpacity": 80, "gradientMode": "none", "hideFrom": { "legend": false, "tooltip": false, "viz": false }, - "insertNulls": false, - "lineInterpolation": "linear", "lineWidth": 1, - "pointSize": 5, "scaleDistribution": { "type": "linear" }, - "showPoints": "auto", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, "thresholdsStyle": { "mode": "off" } }, + "mappings": [ + { + "options": { + "dislike": { + "color": "orange", + "index": 1 + }, + "like": { + "color": "green", + "index": 0 + } + }, + "type": "value" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 3, + "options": { + "barRadius": 0, + "barWidth": 0.9, + "colorByField": "feedback", + "fullHighlight": false, + "groupWidth": 0.7, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "orientation": "auto", + "showValue": "auto", + "stacking": "none", + "tooltip": { + "mode": "single", + "sort": "none" + }, + "xField": "feedback", + "xTickLabelRotation": 0, + "xTickLabelSpacing": 0 + }, + "pluginVersion": "10.2.0", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "P44368ADAD746BC27" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "WITH filtered_feedback AS (\n SELECT mid, feedback, max(feedback_ts)\n FROM feedback\n GROUP BY mid, feedback\n)\nSELECT count(*), feedback, 'baseline' as config FROM filtered_feedback GROUP BY config, feedback;\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Feedback", + "type": "barchart" + }, + { + "datasource": { + "type": "postgres", + "uid": "P44368ADAD746BC27" + }, + "description": "A histogram showing the distribution of the number of messages per conversation.", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1 + }, "mappings": [], - "noValue": "0", "thresholds": { "mode": "absolute", "steps": [ @@ -183,19 +404,16 @@ "h": 8, "w": 12, "x": 12, - "y": 0 + "y": 8 }, - "id": 1, + "id": 4, "options": { + "bucketOffset": 0, "legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" } }, "targets": [ @@ -207,17 +425,12 @@ "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "-- number of messages per 15min window\nWITH msg_timing_info AS (\n SELECT $__timeGroup(server_received_msg_ts, '15m', 0) as t1, count(mid) as num_msgs\n FROM timing\n WHERE $__timeFrom() <= server_received_msg_ts AND server_received_msg_ts <= $__timeTo()\n GROUP BY 1\n ORDER BY $__timeGroup(server_received_msg_ts, '15m', 0)\n), convo_timing_info AS ( -- number of unique conversations per 15 min window\n SELECT $__timeGroup(server_received_msg_ts, '15m', 0) as t2, count(distinct(conversation_id)) as num_convos\n FROM timing JOIN conversations ON timing.mid = conversations.message_id\n WHERE $__timeFrom() <= server_received_msg_ts AND server_received_msg_ts <= $__timeTo()\n GROUP BY 1\n ORDER BY $__timeGroup(server_received_msg_ts, '15m', 0)\n), intervals AS (\n SELECT $__timeGroupAlias(t, '15m', 0) FROM generate_series($__timeFrom(), $__timeTo(), '15 minutes'::interval) AS s(t)\n), msgs_join_convos AS (\n SELECT * FROM msg_timing_info JOIN convo_timing_info ON t1 = t2\n)\nSELECT time, num_msgs, num_convos FROM intervals LEFT OUTER JOIN msgs_join_convos ON t1 = intervals.time;\n", + "rawSql": "SELECT count(message_id)\nFROM conversations\nGROUP BY conversation_id", "refId": "A", "sql": { "columns": [ { - "parameters": [ - { - "name": "*", - "type": "functionParameter" - } - ], + "parameters": [], "type": "function" } ], @@ -230,28 +443,27 @@ } ], "limit": 50 - }, - "table": "timing" + } } ], - "title": "Number of Messages and Distinct Conversations", - "type": "timeseries" + "title": "Messages per Conversation", + "type": "histogram" } ], - "refresh": "", + "refresh": false, "schemaVersion": 38, "tags": [], "templating": { "list": [] }, "time": { - "from": "now-6h", + "from": "now-7d", "to": "now" }, "timepicker": {}, "timezone": "", "title": "A2rchi Usage", "uid": "faf20efc-ffe5-48ae-9a26-debe655bf5a8", - "version": 3, + "version": 4, "weekStart": "" }