Support multiple queries on a single chart in Metrics
What does this MR do?
- Groups metrics based on shared attributes (
y_label
,group
, andtitle
) in the UI. - Supports create/read/update/delete actions for multiple metrics per alert dropdown
CE Port
What's still missing?
-
actually updating common_metrics.yml
to transition canary metrics back to a single chart (Separate MR) - https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/25771 -
adding unit/acceptance tests -
changelog -
commit cleanup -
CE port - https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/25758 -
some more general cleanup I'll comment on in-line
Some screenshots
multiple queries | existing alert | alert dropdown | empty alert | new alert |
---|---|---|---|---|
Local Testing
Prereqs: A project running Prometheus w/ deployed envs (follow setup instructions then create an MR)
- Checkout branch
- Open
rails c
- Check that you have
n
metrics locally: RunPrometheusMetric.count
- Add a new query to one of the existing metrics in
common_metrics.yml
(I just copy & paste one then multiple it by 0.85) - Run:
require Rails.root.join('db/importers/common_metrics_importer.rb')
Importers::CommonMetricsImporter.new.execute
- Confirm that you now have
n+1
metrics: RunPrometheusMetric.count
- Navigate to the monitoring page for your environment (Operations > Environments > tiny chart icon || Show More > tiny chart icon)
- You should already see an additional line on your first graph which just represents 85% of the value of the chart.
- Cleanup: Run
PrometheusMetric.last.destroy
What are the relevant issue numbers?
https://gitlab.com/gitlab-org/gitlab-ce/issues/54877
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated via this MR -
Documentation reviewed by technical writer or follow-up review issue created -
Tests added for this feature/bug -
Tested in all supported browsers -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides - [n/a] Conforms to the database guides
- [n/a] Link to e2e tests MR added if this MR has Requires e2e tests label. See the Test Planning Process.
-
EE specific content should be in the top level /ee
folder - [n/a] For a paid feature, have we considered GitLab.com plans, how it works for groups, and is there a design for promoting it to users who aren't on the correct plan?
-
Security reports checked/validated by reviewer
Edited by Adriel Santiago