gdoc https://docs.google.com/document/d/18620cS-XFIMQfM8AnR0kHeOth88sWRcC3dBFZL4h6xo/edit#
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
xclip -o -selection clipboard | jq '.conditions | { "conditions": . }' | curl -H 'Content-Type: application/json' -X POST --data-binary @- http://admin:admin@localhost:3000/api/alert-definitions/evalOld | jq -r '.instances[0]' | base64 -d > ~/tmp/af && arrow-cat ~/tmp/af |
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
PUT http://admin:admin@localhost:3000/api/alert-definitions/HH7cv0yMk | |
Content-Type: application/json | |
{ | |
"id": 24, | |
"orgId": 1, | |
"title": "First CC Alert", | |
"condition": "B", | |
"data": [ | |
{ |
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
"conditions": [ | |
{ | |
"evaluator": { | |
"params": [ | |
0 | |
], | |
"type": "gt" | |
}, | |
"operator": { | |
"type": "and" |
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
{ | |
name: "pending -> error(keep) with for duration have passed", | |
expected: models.AlertStatePending, | |
applyFn: func(ec *EvalContext) { | |
ec.PrevAlertState = models.AlertStatePending | |
ec.Rule.ExecutionErrorState = models.ExecutionErrorKeepState | |
ec.Error = errors.New("test error") | |
ec.Rule.For = time.Minute * 5 | |
ec.Rule.LastStateChange = time.Now().Add(-time.Minute * 20) | |
}, |
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 | |
{ | |
"name": "Example Alert POST", | |
"condition": { | |
"refId": "C", | |
"interval": 10, | |
"queriesAndExpressions": [ | |
{ |
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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
utc6 := time.FixedZone("UTC+6", 6*3600) | |
utc7 := time.FixedZone("UTC+7", 7*3600) |
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
### | |
GET http://admin:admin@localhost:3000/api/alert-definitions | |
### | |
@alertId = 16 | |
### |
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
benchcmp <(/usr/local/go/bin/go test -benchmem -run=^$ github.com/grafana/grafana/pkg/tsdb/azuremonitor -bench '^(BenchmarkOldInsights)$' -v | sed 's/BenchmarkOldInsights/BenchmarkInsightsMetricsResultToFrame/g') <(/usr/local/go/bin/go test -benchmem -run=^$ github.com/grafana/grafana/pkg/tsdb/azuremonitor -bench '^(BenchmarkInsightsMetricsResultToFrame)$' -v) |
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
package azuremonitor | |
import ( | |
"encoding/json" | |
"fmt" | |
"time" | |
"github.com/grafana/grafana-plugin-sdk-go/data" | |
) |