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 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.
It seems like changing certain configurations, like the data source name, through the YAML file doesn’t reflect in Grafana UI. This behavior might be Change by design to maintain consistency or due to how Grafana handles configuration updates. For a definitive answer, reaching out to the Grafana community or support would be a good idea. They can provide insights into the design choices and how best to manage configuration changes. Hope this helps!
The debug level setting by @melori.arellano helped me fix this for our configuration. I did not know that you have to increase the version number so the change takes effect. If you do not increase the version number, you get this log output:
logger=provisioning.datasources t=2024-02-23T19:34:06.824485382Z level=debug msg="ignoring old version of datasource" name=Tempo uid=tempo