Skip to content

gitserver: move repo_count metrics to worker

Warren Gifford requested to merge dd/metrics-gitserver-repo-count into main

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

  1. sg start and sg start monitoring
  2. Visit http://localhost:6089/metrics and check that src_gitserver_repo_count is present.
  3. Verify the metric value matches the result of this query:

SELECT COUNT(*) FROM repo WHERE deleted_at IS NULL;

Merge request reports

Loading