Fix counts.ci_runners_online metric
What does this MR do and why?
This MR fixes the counts.ci_runners_online metric, which doesn't appear to have gained an instrumentation_class when these metrics were converted a while back.
Changelog: fixed
References
- Runner stage instrumentation audit (#554144 - closed)
- Add CI runner counts to usage ping (!58197 - merged)
Database query plan
Gitlab::Usage::ServicePing::InstrumentedPayload.new(['counts.ci_runners_online'], :with_instrumentation).build
https://console.postgres.ai/gitlab/gitlab-production-ci/sessions/41625/commands/127775
SELECT COUNT("ci_runners"."id")
FROM "ci_runners"
WHERE "ci_runners"."contacted_at" > '2025-07-17 10:04:57.550829'
Aggregate (cost=32136.98..32136.99 rows=1 width=8) (actual time=1639.773..1643.640 rows=1 loops=1)
Buffers: shared hit=127777 read=7662 dirtied=4916
WAL: records=5908 fpi=4916 bytes=24635097
I/O Timings: read=3655.562 write=0.000
-> Gather (cost=32136.76..32136.97 rows=2 width=8) (actual time=1639.761..1643.630 rows=3 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=127777 read=7662 dirtied=4916
WAL: records=5908 fpi=4916 bytes=24635097
I/O Timings: read=3655.562 write=0.000
-> Aggregate (cost=31136.76..31136.77 rows=1 width=8) (actual time=1632.600..1632.603 rows=1 loops=3)
Buffers: shared hit=127777 read=7662 dirtied=4916
WAL: records=5908 fpi=4916 bytes=24635097
I/O Timings: read=3655.562 write=0.000
-> Parallel Append (cost=0.55..30867.98 rows=107515 width=8) (actual time=2.521..1627.702 rows=71506 loops=3)
Buffers: shared hit=127777 read=7662 dirtied=4916
WAL: records=5908 fpi=4916 bytes=24635097
I/O Timings: read=3655.562 write=0.000
-> Parallel Index Only Scan using project_type_ci_runners_e59bb2812d_contacted_at_id_idx on public.project_type_ci_runners ci_runners_3 (cost=0.55..18628.66 rows=68084 width=8) (actual time=3.538..1008.230 rows=42215 loops=3)
Index Cond: (ci_runners_3.contacted_at > '2025-07-17 10:04:57.550829+00'::timestamp with time zone)
Heap Fetches: 23859
Buffers: shared hit=72462 read=4896 dirtied=3138
WAL: records=3861 fpi=3138 bytes=16774344
I/O Timings: read=2347.736 write=0.000
-> Parallel Index Only Scan using group_type_ci_runners_e59bb2812d_contacted_at_id_idx2 on public.group_type_ci_runners ci_runners_2 (cost=0.55..11678.19 rows=39407 width=8) (actual time=0.950..915.071 rows=43908 loops=2)
Index Cond: (ci_runners_2.contacted_at > '2025-07-17 10:04:57.550829+00'::timestamp with time zone)
Heap Fetches: 15124
Buffers: shared hit=55285 read=2746 dirtied=1759
WAL: records=2028 fpi=1759 bytes=7818154
I/O Timings: read=1296.729 write=0.000
-> Parallel Index Only Scan using instance_type_ci_runners_e59bb2812d_contacted_at_id_idx on public.instance_type_ci_runners ci_runners_1 (cost=0.27..23.55 rows=34 width=8) (actual time=2.509..12.912 rows=57 loops=1)
Index Cond: (ci_runners_1.contacted_at > '2025-07-17 10:04:57.550829+00'::timestamp with time zone)
Heap Fetches: 52
Buffers: shared hit=30 read=20 dirtied=19
WAL: records=19 fpi=19 bytes=42599
I/O Timings: read=11.096 write=0.000
Settings: effective_cache_size = '338688MB', seq_page_cost = '4', jit = 'off', random_page_cost = '1.5', work_mem = '100MB'
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Pedro Pombeiro