grafana / grizzly

A utility for managing Jsonnet dashboards against the Grafana API
https://grafana.github.io/grizzly/
Apache License 2.0
514 stars 66 forks source link

[Bug]: missing tenant-id error after upgrading grr #457

Closed thampiotr closed 3 months ago

thampiotr commented 3 months ago

Grizzly Version

grr version v0.4.3

Expected Behavior

Prom alerts get updated after I change the jsonnet file.

Actual Behavior

repro git:(main) ✗ GRAFANA_URL=http://localhost:3000 grr watch -l debug ./ ./grizzly.jsonnet
Providers: Grafana - active, Mimir - inactive (mimir address is not set), Synthetic Monitoring - inactive (stack id is not set)
INFO[0000] Watching for changes
INFO[0010] Changes detected. Parsing
INFO[0010] Changes detected. Applying grizzly.jsonnet
DEBU[0010] Getting the remote value for `PrometheusRuleGroup.test`
PrometheusRuleGroup.test failed: missing tenant-id
ERRO[0010] Error: 1 error occurred:
    * missing tenant-id

Steps to Reproduce

Use an example conifg:

{
  prometheusAlerts+:: {
    groups: [
      {
        name: 'test',
        rules: [
          {
            alert: 'test_alert',
            expr: 'query',
            annotations: {
              message: 'message',
            },
            'for': '10s',
          },
        ],
      },
    ],
  },
}

Run GRAFANA_URL=http://localhost:3000 grr watch -l debug ./ ./grizzly.jsonnet.

Change the config file and save it, observe the error quoted above.

thampiotr commented 3 months ago

Sorry, I have realised that this is because to sync alert rules, one needs to have the mimir related environment variables set. I wish the error message was more useful.