Skip to content

Add alert metric image table and basic model

Sean Arnold requested to merge 340852-alert-metric-image-db-and-model into master

What does this MR do and why?

This MR adds a new API to upload, view, update and delete Metric Images for AlertManagement::Alert objects. These images are intended to provide context around the Alert, such as additional metrics from other reporting tools the user may be using, much like you can do with Incident metrics.

This MR:

  • Adds a new AlertManagement::MetricImage model, and associated tables

Note: This was broken out of a larger MR; !79083 (closed).

Database changes

Up
== 20220120033115 CreateAlertManagementAlertMetricImages: migrating ===========
-- create_table(:alert_management_alert_metric_images, {})
   -> 0.0278s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0003s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE alert_management_alert_metric_images\nADD CONSTRAINT check_4d811d9007\nCHECK ( char_length(url) <= 255 )\nNOT VALID;\n")
   -> 0.0013s
-- current_schema()
   -> 0.0002s
-- execute("SET statement_timeout TO 0")
   -> 0.0007s
-- execute("ALTER TABLE alert_management_alert_metric_images VALIDATE CONSTRAINT check_4d811d9007;")
   -> 0.0009s
-- execute("RESET statement_timeout")
   -> 0.0007s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0003s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE alert_management_alert_metric_images\nADD CONSTRAINT check_70fafae519\nCHECK ( char_length(file) <= 255 )\nNOT VALID;\n")
   -> 0.0012s
-- current_schema()
   -> 0.0003s
-- execute("ALTER TABLE alert_management_alert_metric_images VALIDATE CONSTRAINT check_70fafae519;")
   -> 0.0010s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0003s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE alert_management_alert_metric_images\nADD CONSTRAINT check_2587666252\nCHECK ( char_length(url_text) <= 128 )\nNOT VALID;\n")
   -> 0.0010s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE alert_management_alert_metric_images VALIDATE CONSTRAINT check_2587666252;")
   -> 0.0010s
== 20220120033115 CreateAlertManagementAlertMetricImages: migrated (0.0964s) ==
Down
== 20220120033115 CreateAlertManagementAlertMetricImages: reverting ===========
-- drop_table(:alert_management_alert_metric_images, {:if_exists=>true})
   -> 0.0216s
== 20220120033115 CreateAlertManagementAlertMetricImages: reverted (0.0217s) ==

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #340852 (closed)

Edited by Sean Arnold

Merge request reports