mysql> desc data_source;
+---------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+--------------+------+-----+---------+----------------+
| id | bigint(20) | NO | PRI | NULL | auto_increment |
Some Notes on Data source Info / Data source Ref:
-
Terms I'm using for these notes:
- DatasourceRef: is model that includes (uid+type), is saved by dashboards and alerting (note: alerting is current UID only)
- DatasourceInfo: is full information that a datasource neededs to execute a request, and can be looked up by the Ref
-
Contexts:
- Alerting: The Ref is saved. Alerts run as a service, so in this context there is no user (although perhaps there should be a service user or role). Therefore for saved alerts run by the service, authorization is done at creation time, not run time - (as users would not want alerts to stop working if a user is removed).
- Query API: Runtime, in this context there is a user
-
Main Question:
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
// Dataframe is a columnar table made up of fields | |
#Dataframe: { | |
Name: string, | |
Fields: [...#Field] | |
_fieldLen: int | |
// all fields must be the same length | |
// error message may be like "missMatchedLen._fieldLen: conflicting values 2 and 3" if an instance of | |
// Dataframe. This is because _fieldLen does not collacse to the same value |
In order to figure what is going on with Grafana managed alerts generic issue, we can use (or need) the following information.
Less may be needed depending how far along in the pipeline the issue is (if it is at the end like notifications, then can need all the stuff that takes us to that point).
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
{ | |
"template_files": {}, | |
"alertmanager_config": { | |
"route": { | |
"receiver": "webhook_test", | |
"group_by": [ | |
"alertname" | |
] | |
}, | |
"templates": [], |
- Load the dashboard alert from
alert
table and create rules in thealert_rule
table- Translate conditions and queries into SSE for the
alert_rule
row - Translate other settings like NoData,FOR,Interval,alertRuleTags,(notifications?) for
alert_rule
row - Match Permissions of dashboard alert (create folders as needed):
- Alerts will not have permissions, Folders will
- If alert's dashboard has permissions, create corresponding folder to match permissions
- Translate conditions and queries into SSE for the
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
POST http://admin:admin@localhost:3000/api/alert-definitions/ | |
Content-Type: application/json | |
{ | |
"title": "classic many", | |
"condition": "G", | |
"data": [ | |
{ | |
"refId": "A", |
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
POST http://admin:admin@localhost:3000/ruler/grafana/api/v1/rules/ng-alert-demo | |
Content-Type: application/json | |
{ | |
"name": "test-group2", | |
"interval": "10s", | |
"rules": [ | |
{ | |
"grafana_alert": { | |
"title": "pp query with SSE classic condition", |
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
POST http://admin:admin@localhost:3000/ruler/grafana/api/v1/rules/ng-alert-demo | |
Content-Type: application/json | |
{ | |
"name": "test-group", | |
"interval": "10s", | |
"rules": [ | |
{ | |
"grafana_alert": { | |
"title": "prom query with SSE classic condition", |