How can I change file-provisioned resources (by changing the source file)?

It looks to me as if changing an already provisioned alert rule, by changing the yaml file at a later point, does not actually change the rule in grafana. Is that so? If so: Is that by design?

I ask because I am able to change certain other things by changing the source yaml file. For example, if I have this data source:

    apiVersion: 1
    datasources:
    - name: Loki
      type: loki
      access: proxy
      uid: datasource-loki
      url: "http://loki:3100"
      version: 1
      isDefault: true
      jsonData:
        derivedFields:
          - datasourceUid: datasource-tempo
            matcherRegex: '"otelTraceID": "(\\"|[^"]*)"'
            name: otelTraceID
            url: "$${__value.raw}"

Then I change the name of the derived field like this:

            name: otelTraceID424242

Then I do in fact see that change in the grafana UI.

However, if I change the name of the data source, like this:

    - name: Loki-will-you-change

Then I do not see that change in the grafana UI.

Welcome to the :grafana: community @stianlagstad!

The files are read when grafana is started OR if you perform a reload using the provisioning API.

For alerting you would use this API with basic authentication:

POST /api/admin/provisioning/alerting/reload

Thank you very much for the response!

What I see locally is this:

  • Alert rules do change when I change the source file + restart grafana
  • Dashboard names DO NOT change when I change the source file + restart grafana
  • Data source names DO NOT change when I change the source file + restart grafana

Is this to be expected? Are some fields changeable, and some not?

@stianlagstad Do you see any errors in the grafana log file when restarting grafana after changing the file?

If you can enable debug logging, it should log what it does when it encounters your provisioning file. To enable it, edit the configuration file grafana.ini:

[log]
# Either "console", "file", "syslog". Default is console and file
# Use space to separate multiple modes, e.g. "console file"
mode = console file

# Either "debug", "info", "warn", "error", "critical", default is "info"
level = debug

Then restart grafana for the setting to go into effect.