Skip to content

Instantly share code, notes, and snippets.

View kylebrandt's full-sized avatar
🦥
🛠️

Kyle Brandt kylebrandt

🦥
🛠️
View GitHub Profile
@kylebrandt
kylebrandt / notes.md
Last active November 17, 2021 13:32
Data source Info / Ref Notes

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:

@kylebrandt
kylebrandt / frame.cue
Last active October 28, 2021 18:40
DF Cue WIP
// 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
@kylebrandt
kylebrandt / gmAlertNeededIssueInfo.md
Last active August 10, 2021 14:11
Grafana Managed Alert: Needed info for debugging issues

Grafana Managed Alert Rule Issue Debugging

Needed context

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).

Configuration

{
"template_files": {},
"alertmanager_config": {
"route": {
"receiver": "webhook_test",
"group_by": [
"alertname"
]
},
"templates": [],
@kylebrandt
kylebrandt / notes.md
Last active April 12, 2021 17:31
alert migration notes

Alert Migration Notes

List of things the migration does or will need to do

  • Load the dashboard alert from alert table and create rules in the alert_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
@kylebrandt
kylebrandt / many_cc.http
Created April 6, 2021 14:35
Lots of Conditions
POST http://admin:admin@localhost:3000/api/alert-definitions/
Content-Type: application/json
{
"title": "classic many",
"condition": "G",
"data": [
{
"refId": "A",
@kylebrandt
kylebrandt / rule.http
Last active April 2, 2021 16:49
Changing Rule Post Example (predicatable pulse)
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",
@kylebrandt
kylebrandt / rulerPostExample.http
Created March 31, 2021 17:00
cc ruler post example
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",
@kylebrandt
kylebrandt / cc.jpg
Last active March 5, 2021 15:28
CC and Translation Progress
cc.jpg
@kylebrandt
kylebrandt / example.sh
Created March 3, 2021 20:11
evalOld using copy of settings column (jq/curl)
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