-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #552 from Altinity/issue-458
fix corner cases for UI alert time range
- Loading branch information
Showing
3 changed files
with
390 additions
and
13 deletions.
There are no files selected for viewing
339 changes: 339 additions & 0 deletions
339
docker/grafana/dashboards/alert_from_and_to_macros_issue_458.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,339 @@ | ||
{ | ||
"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, | ||
"links": [], | ||
"panels": [ | ||
{ | ||
"alert": { | ||
"alertRuleTags": {}, | ||
"conditions": [ | ||
{ | ||
"evaluator": { | ||
"params": [ | ||
0 | ||
], | ||
"type": "gt" | ||
}, | ||
"operator": { | ||
"type": "and" | ||
}, | ||
"query": { | ||
"params": [ | ||
"A", | ||
"15m", | ||
"now" | ||
] | ||
}, | ||
"reducer": { | ||
"params": [], | ||
"type": "max" | ||
}, | ||
"type": "query" | ||
} | ||
], | ||
"executionErrorState": "alerting", | ||
"for": "1m", | ||
"frequency": "1m", | ||
"handler": 1, | ||
"name": "alert with $timeFilter macros", | ||
"noDataState": "no_data", | ||
"notifications": [] | ||
}, | ||
"datasource": { | ||
"type": "vertamedia-clickhouse-datasource", | ||
"uid": "P7E099F39B84EA795" | ||
}, | ||
"description": "mage test build:linux && GF_UNIFIED_ALERTING_ENABLED=false GF_ALERTING_ENABLED=true npm run server\nhttps://github.com/Altinity/clickhouse-grafana/issues/458", | ||
"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" | ||
}, | ||
{ | ||
"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": [ | ||
{ | ||
"add_metadata": false, | ||
"database": "default", | ||
"datasource": { | ||
"type": "vertamedia-clickhouse-datasource", | ||
"uid": "P7E099F39B84EA795" | ||
}, | ||
"dateColDataType": "EventDate", | ||
"dateTimeColDataType": "EventTime", | ||
"dateTimeType": "DATETIME", | ||
"editorMode": "builder", | ||
"extrapolate": true, | ||
"format": "time_series", | ||
"formattedQuery": "/* UI alerts with `timeFilter` */ SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t", | ||
"interval": "", | ||
"intervalFactor": 1, | ||
"query": "/* UI alerts with `timeFilter` */ SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t", | ||
"rawQuery": "/* UI alerts with `timeFilter` */\nSELECT (intDiv(toUInt32(EventTime), 15) * 15) * 1000 as t, count() FROM default.test_alerts WHERE EventTime >= toDateTime(1714858479) AND EventTime <= toDateTime(1714880079) GROUP BY t ORDER BY t", | ||
"refId": "A", | ||
"round": "0s", | ||
"skip_comments": true, | ||
"table": "test_alerts" | ||
} | ||
], | ||
"thresholds": [ | ||
{ | ||
"colorMode": "critical", | ||
"op": "gt", | ||
"value": 0, | ||
"visible": true | ||
} | ||
], | ||
"title": "alert with timeFilter macro", | ||
"type": "timeseries" | ||
}, | ||
{ | ||
"alert": { | ||
"alertRuleTags": {}, | ||
"conditions": [ | ||
{ | ||
"evaluator": { | ||
"params": [ | ||
0 | ||
], | ||
"type": "gt" | ||
}, | ||
"operator": { | ||
"type": "and" | ||
}, | ||
"query": { | ||
"params": [ | ||
"A", | ||
"15m", | ||
"now" | ||
] | ||
}, | ||
"reducer": { | ||
"params": [], | ||
"type": "max" | ||
}, | ||
"type": "query" | ||
} | ||
], | ||
"executionErrorState": "alerting", | ||
"for": "1m", | ||
"frequency": "1m", | ||
"handler": 1, | ||
"name": "alert with from and to macro alert", | ||
"noDataState": "no_data", | ||
"notifications": [] | ||
}, | ||
"datasource": { | ||
"type": "vertamedia-clickhouse-datasource", | ||
"uid": "P7E099F39B84EA795" | ||
}, | ||
"description": "https://github.com/Altinity/clickhouse-grafana/issues/458", | ||
"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": 2, | ||
"options": { | ||
"legend": { | ||
"calcs": [], | ||
"displayMode": "list", | ||
"placement": "bottom", | ||
"showLegend": true | ||
}, | ||
"tooltip": { | ||
"mode": "single", | ||
"sort": "none" | ||
} | ||
}, | ||
"targets": [ | ||
{ | ||
"add_metadata": false, | ||
"database": "default", | ||
"datasource": { | ||
"type": "vertamedia-clickhouse-datasource", | ||
"uid": "P7E099F39B84EA795" | ||
}, | ||
"dateColDataType": "EventDate", | ||
"dateTimeColDataType": "EventTime", | ||
"dateTimeType": "DATETIME", | ||
"editorMode": "builder", | ||
"extrapolate": true, | ||
"format": "time_series", | ||
"formattedQuery": "/* UI alerts with `from` and `to` */ SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t", | ||
"interval": "15s", | ||
"intervalFactor": 1, | ||
"query": "/* UI alerts with `from` and `to` */ SELECT $timeSeries as t, count() FROM $table WHERE EventTime>=$from AND EventTime<=$to GROUP BY t ORDER BY t", | ||
"rawQuery": "/* UI alerts with `from` and `to` */ SELECT (intDiv(toUInt32(EventTime), 15) * 15) * 1000 as t, count() FROM default.test_alerts WHERE EventTime >= 1714858479 AND EventTime <= 1714880079 GROUP BY t ORDER BY t", | ||
"refId": "A", | ||
"round": "0s", | ||
"showFormattedSQL": true, | ||
"skip_comments": true, | ||
"table": "test_alerts" | ||
} | ||
], | ||
"thresholds": [ | ||
{ | ||
"colorMode": "critical", | ||
"op": "gt", | ||
"value": 0, | ||
"visible": true | ||
} | ||
], | ||
"title": "alert with from and to macro", | ||
"type": "timeseries" | ||
} | ||
], | ||
"schemaVersion": 39, | ||
"tags": [], | ||
"templating": { | ||
"list": [] | ||
}, | ||
"time": { | ||
"from": "now-6h", | ||
"to": "now" | ||
}, | ||
"timepicker": {}, | ||
"timezone": "browser", | ||
"title": "alerts from and to from UI issue-458", | ||
"uid": "issue_458_alert_time_range_from_ui", | ||
"version": 1, | ||
"weekStart": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.