New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alerting: Modify alertmanager endpoints for proxying using the datasource UID #47978
Conversation
case http.MethodPost + "/api/alertmanager/{DatasourceID}/api/v2/silences": | ||
eval = ac.EvalPermission(ac.ActionAlertingInstancesExternalWrite, datasources.ScopeProvider.GetResourceScope(ac.Parameter(":DatasourceID"))) | ||
case http.MethodPost + "/api/alertmanager/uid/{DatasourceUID}/api/v2/silences": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're up for it, it would be great to make a path function that at least provides the prefix:
AMV2Path(pathSuffix) string {
return path.Join("/api/alertmanager/datasource/{DatasourceUID}/api/v2", pathSuffix)
}
...
AMV2Path("silence/{SIlenceID")
that makes it easier to scan which API is being evaluated.
If not, I'll create an issue and I can tackle it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What this PR does / why we need it:
follow-up of #47829
This is part of work of removing the sequential IDs from the API and store layers. For more details you can refer to this doc.
More specifically, it:
ProxyDatasourceRequestWithUID()
so that now optionally expects a string for passing the datasource UID to look for; if it's not provided then theuid
path parameter value is used.DatasourceUID
path parameter instead ofDatasourceID
Example of a successful request to a known datasource UID:
Example of requesting an unknown datasource UID:
Release notice breaking change
Grafana alerting endpoints prefixed with
api/alertmanager/
that proxy requests to an Alertmanager now expect the data source UID as a path parameter instead of the data source numeric identifier.