grafana-client
grafana-client copied to clipboard
Add x-disable-provenance header to allow alert rules to be edited from the UI
What API call you use?
- Based on this PR https://github.com/grafana/grafana/pull/58410 which was merged in the new version 9.3.0, we can the header
x-disable-provenanceto allow the alert rules created under the alert provisioning API to be modifiable via UI.
This can only be added on the POST request, if we try to update with the PUT operation an alert has already been created we got the following error:
{
"message": "cannot changed provenance from 'api' to ''",
"traceID": ""
}
What is the actual output?
- Without the header when the rule is created we cannot edit the alert rules via UI, we got the label "provisioned".
What is the expected output? And what output is expected.
- Alerts created with the header can be edited via UI like in the s screenshot below

Hi Johan Sebastian,
that's a very good suggestion, thank you. Are you sure the header should not be attached to the PUT request as well?
Citing the post...
We are enabling a workaround within the Provisioning API to do it by adding the
x-disable-provenanceheader to the following requests:POST /api/v1/provisioning/alert-rules PUT /api/v1/provisioning/alert-rules/{UID}
... makes me think the header should be attached to both types of requests, no?
With kind regards, Andreas.
I've just submitted #53, following your suggestion. Do you agree with the implementation?
Hi @amotl,
Sorry for the delay, I tested on PUT operation and I get the error I mentioned, the error only happens when there is a rule already created without the header and we try to update it.
This is the only consideration!
Hi again,
I tested on PUT operation and I get the error I mentioned, the error only happens when there is a rule already created without the header and we try to update it.
All right. I see, that makes sense. With the new improvements from #53, you will be able to control sending the header on your own behalf, by using the disable_provenance argument on the methods create_alertrule and update_alertrule.
The improvement has been released with grafana-client 3.4.0. Feedback is very much appreciated.
With kind regards, Andreas.
Hi @jyepesr1,
have you been able to test the feature successfully?
With kind regards, Andreas.
Hi @amotl ,
I was able to test it out successfully. It works like a charm!
Thanks again
Excellent, thank you for reporting back, and for your suggestion in the first place. Cheers, Andreas.