Skip to content

Metrics & Monitoring

Repo Guard exposes Prometheus metrics under the repo_guard_* namespace, a PodMonitor for Prometheus Operator, and bundled alerting rules.

Exported Metrics

Reconcile metrics

MetricTypeLabelsDescription
repo_guard_controller_reconcile_totalCountercontroller, resultTotal reconciliations per controller and result (success, error, requeue).
repo_guard_controller_reconcile_duration_secondsHistogramcontrollerReconcile durations.

External API metrics

MetricTypeLabelsDescription
repo_guard_external_api_requests_totalCounterprovider, operation, statusExternal provider API calls. status is an HTTP status code or success/error.
repo_guard_external_api_request_duration_secondsHistogramprovider, operationExternal provider API call durations.

GithubOrganization metrics

MetricTypeLabelsDescription
repo_guard_githuborganization_statusGaugegithub, organization, statusOne-hot gauge for the organization's current reconcile status.
repo_guard_githuborganization_operationsGaugegithub, organization, scope, operation, stateCount of queued operations by scope, operation, and state.
repo_guard_githuborganization_managed_teams_totalGaugegithub, organizationNumber of tracked teams for this organization.
repo_guard_githuborganization_managed_repos_totalGaugegithub, organization, visibilityNumber of managed repositories partitioned by visibility.
repo_guard_githuborganization_sync_failures_totalCountergithub, organization, scopeCumulative reconcile cycles that ended in a failed state, by scope.
repo_guard_githuborganization_pending_operations_totalGaugegithub, organizationTotal pending (not yet executed) operations across all scopes.
repo_guard_githuborganization_status_payload_bytesGaugegithub, organizationJSON byte size of the status subresource before each status update attempt (updated again post-shrink when adaptive TTL shrinking is applied). Alert when > 1 MB.

GithubTeam metrics

MetricTypeLabelsDescription
repo_guard_githubteam_statusGaugeorganization, team, statusOne-hot gauge for the team's current reconcile status.
repo_guard_githubteam_operationsGaugeorganization, team, operation, stateCount of member operations by operation and state.
repo_guard_githubteam_managed_members_totalGaugeorganization, teamNumber of members currently managed in this team.
repo_guard_githubteam_sync_failures_totalCounterorganization, teamCumulative reconcile cycles that ended in a failed state.

GitHub API metrics

MetricTypeLabelsDescription
repo_guard_github_ratelimit_hits_totalCountercontroller, typeGitHub API rate-limit events encountered. type is api or invitation.
repo_guard_github_ratelimit_backoff_secondsHistogramcontrollerDuration of rate-limit backoff windows.
repo_guard_github_graphql_calls_totalCountergithub, organization, resultGitHub GraphQL calls made by ExtendedListGraphQL.
repo_guard_github_etag_cache_hits_totalCountergithub, organization, endpointGitHub REST requests that returned HTTP 304 (ETag cache hit).
repo_guard_github_etag_cache_misses_totalCountergithub, organization, endpointGitHub REST requests that returned HTTP 200 with a cacheable ETag.

PromQL Examples

Basic Reconcile Activity

sum by (controller) (rate(repo_guard_controller_reconcile_total[5m]))

Error Rate per Controller

sum by (controller) (increase(repo_guard_controller_reconcile_total{result="error"}[10m]))
/
clamp_min(sum by (controller) (increase(repo_guard_controller_reconcile_total[10m])), 1)

Reconcile Latency (p50 / p90 / p95)

histogram_quantile(0.5,  sum by (controller,le) (rate(repo_guard_controller_reconcile_duration_seconds_bucket[10m])))
histogram_quantile(0.9,  sum by (controller,le) (rate(repo_guard_controller_reconcile_duration_seconds_bucket[10m])))
histogram_quantile(0.95, sum by (controller,le) (rate(repo_guard_controller_reconcile_duration_seconds_bucket[10m])))

External API Error Rate per Provider/Operation

sum by (provider,operation) (increase(repo_guard_external_api_requests_total{status=~"error|[45].."}[10m]))
/
clamp_min(sum by (provider,operation) (increase(repo_guard_external_api_requests_total[10m])), 1)

External API Latency p95

histogram_quantile(0.95, sum by (provider,operation,le) (rate(repo_guard_external_api_request_duration_seconds_bucket[10m])))

No Reconcile Activity (per controller)

sum by (controller) (increase(repo_guard_controller_reconcile_total[30m]))

Alerting Rules

Bundled alerting rules are deployed via the Helm chart (charts/repo-guard/templates/prometheusrules.yaml). The kustomize equivalent lives in config/prometheus/rules.yaml. The shipped alerts are:

Controller alerts

  • GithubGuardControllerHighErrorRate — error rate above 5% for a controller over 10 minutes.
  • GithubGuardControllerVeryHighErrorRate — error rate above 15% for a controller over 10 minutes.
  • GithubGuardControllerSlowReconcileP95 — p95 reconcile duration exceeds 10 s over 15 minutes.
  • GithubGuardControllerNoReconciles — no reconciliations observed in 30 minutes (potential controller liveness issue).

External provider alerts

  • GithubGuardExternalAPIHighErrorRate — external provider API error rate above 10% over 10 minutes.
  • GithubGuardExternalAPISlowP95 — external provider p95 latency exceeds 5 s over 15 minutes.

Domain alerts

  • GithubGuardOrgRateLimited — an organization has been in rate-limited state for more than 5 minutes.
  • GithubGuardHighPendingOperations — an organization has more than 50 pending operations for over 30 minutes.
  • GithubGuardOrgSyncFailureSpike — an organization has failed reconciliation more than 5 times in 30 minutes.
  • GithubGuardTeamSyncFailureSpike — a team has failed reconciliation more than 5 times in 30 minutes.
  • GithubGuardRateLimitFrequent — more than 10 GitHub rate-limit hits in 1 hour.

PodMonitor

The Helm chart ships a PodMonitor that Prometheus Operator will pick up automatically when monitoring.podMonitor.enabled: true is set in the Helm values.

Perses Dashboard

A Perses dashboard is deployed via the Helm chart as a ConfigMap when perses.enabled: true. Import it into your Perses instance to get pre-built panels for all the metrics above.

Released under the Apache 2.0 License.