Skip to content

Migrate prometheus integrations to HTTP alert integrations

Sarah Yasonik requested to merge sy-migrate-prometheus-integrations into master

What does this MR do and why?

Migrates Integrations::Prometheus records saved in the integrations table to the alert_management_http_integrations table. This allows alerting functionality to be preserved for Prometheus, even though the Metrics Dashboard is in the process of being removed.

Database impact for dot-com database

  • ~500 records added to AlertManagement::HttpIntegration (from Integrations::Prometheus& Alerting::ProjectAlertingSetting)
    • There are ~150k Integrations::Prometheus records, but only ~500 of these have alerting configured. We only care about the 500.
  • Queries & query plans are below.

up

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/21343/commands/69500

 ModifyTable on public.alert_management_http_integrations  (cost=0.71..212.63 rows=59 width=227) (actual time=23.969..23.971 rows=0 loops=1)
   Buffers: shared hit=620 read=157 dirtied=14 written=3
   I/O Timings: read=20.163 write=0.000
   ->  Nested Loop Left Join  (cost=0.71..212.63 rows=59 width=227) (actual time=1.676..18.317 rows=59 loops=1)
         Buffers: shared hit=199 read=141 dirtied=1
         I/O Timings: read=16.355 write=0.000
         ->  Index Scan using project_alerting_settings_pkey on public.project_alerting_settings  (cost=0.28..8.49 rows=59 width=89) (actual time=0.117..0.542 rows=59 loops=1)
               Index Cond: ((project_alerting_settings.project_id >= 1) AND (project_alerting_settings.project_id <= 15422333))
               Buffers: shared hit=28 read=5
               I/O Timings: read=0.429 write=0.000
         ->  Index Scan using index_integrations_on_project_id_and_type_new_unique on public.integrations  (cost=0.43..3.45 rows=1 width=5) (actual time=0.281..0.281 rows=1 loops=59)
               Index Cond: ((integrations.project_id = project_alerting_settings.project_id) AND (integrations.type_new = 'Integrations::Prometheus'::text))
               Buffers: shared hit=101 read=131
               I/O Timings: read=15.252 write=0.000

down

https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/21341/commands/69493

DELETE FROM "alert_management_http_integrations" 
WHERE "alert_management_http_integrations"."type_identifier" = 1 
AND "alert_management_http_integrations"."endpoint_identifier" = 'legacy-prometheus' 
 ModifyTable on public.alert_management_http_integrations  (cost=0.28..168.81 rows=121 width=6) (actual time=1.381..1.382 rows=0 loops=1)
   Buffers: shared hit=937
   I/O Timings: read=0.000 write=0.000
   ->  Index Scan using index_http_integrations_on_project_and_endpoint on public.alert_management_http_integrations  (cost=0.28..168.81 rows=121 width=6) (actual time=0.077..0.933 rows=535 loops=1)
         Index Cond: (alert_management_http_integrations.endpoint_identifier = 'legacy-prometheus'::text)
         Filter: (alert_management_http_integrations.type_identifier = 1)
         Rows Removed by Filter: 0
         Buffers: shared hit=402
         I/O Timings: read=0.000 write=0.000

How to set up and validate locally

See !123217 (merged)

MR acceptance checklist

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

Edited by Sarah Yasonik

Merge request reports