gitserver: move repo_count metrics to worker
Created by: danieldides
Moves the src_gitserver_repo_count
and src_gitserver_repo_last_error_total
metrics out of gitserver
metrics and to the worker. This query takes over 2.5s to resolve on DotCom and could cause performance issues as it runs once per replica of gitserver
. This solution is probably a stop-gap, there's some Slack discussion about creating a stats table reliant on triggers to move statistics like this into.
Test plan
-
sg start
andsg start monitoring
- Visit http://localhost:6089/metrics and check that
src_gitserver_repo_count
is present. - Verify the metric value matches the result of this query:
SELECT COUNT(*) FROM repo WHERE deleted_at IS NULL;