Setting alerts is broken with prometheus endpoint enabled
Summary
If I go to the metrics dashboard in EE, then attempt to create an alert, the alert dropdown options are not editable.
Steps to reproduce
- Create a project with autodevops.
- Connect a kubernetes cluster.
- Deploy to an environment.
- Navigate to Operations > Metrics.
- Click the adorable little bell next to a chart & attempt to create a new alert.
Example Project
https://staging.gitlab.com/syasonik-admin/autodevops-deploy/environments/176851/metrics
^ Must have reporter level user in the project. Ping @syasonik for access.
What is the current bug behavior?
Nothing - user input is not allowed.
What is the expected correct behavior?
The operation should be selectable. The threshold should be editable.
Relevant logs and/or screenshots
Possible fixes
app/assets/javascripts/monitoring/stores/utils.js#39
groups metrics onto single charts. On line 42, const metricId = chart.id ? chart.id.toString() : null;
the value of id
is no longer returned from the backend in that spot. Rather, the value is included in the query/metric info.
So, line 47 should be updated to look something like:
queries.forEach(queryAttrs =>
accumulator[chartKey].queries.push({
metricId: metricId || queryAttrs.metric_id,
...queryAttrs,
}),
);