Add new table to connect issues to metrics
What does this MR do and why?
- Adds a new table
observability_metrics_issues_connectionsto store the connection between anIssueand aMetricwhere metrics are stored in Gitlab Observability Backend.- This MR doesn't actually connect to GOB at all, so doesn't require it to validate the MR.
- The table also includes a
namespace_idsharding key for cells which is automatically populated using a Railsafter_createcallback.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
-
Run the migrations in this MR (
rails db:migrate) -
Open a
rails console. -
Create a new instance of the model, with an issue and save it.
a = Observability::MetricsIssuesConnection.new(issue: Issue.last, metric_type: :sum_type, metric_name: "testing1234") a.save! -
Note the additional
UPDATEstatement after the object is persisted that should setnamespace_id.
Related to gitlab-org/opstrace/opstrace#2884 (closed)
Edited by Max Woolf