gobackup / gobackup/gobackup-operator
Observability & alerting: populate Conditions, Prometheus metrics, Events, ServiceMonitor + alerts
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 23
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
Summary
Export the data the status loop already computes. reconcileJobStatus tracks per-run phases, counters, and failure logs — but observability stops at kubectl describe. This is the lowest-effort step toward a fleet backup control plane: populate Conditions, emit metrics + Events, and ship ready-made alerts.
Gaps (grounded in current code)
Status.Conditionsdeclared but never written.BackupStatus.Conditions []metav1.Conditionexists (api/v1/backup_types.go:129) but no reconcile path callsapimeta.SetStatusCondition. Sokubectl wait --for=condition=Ready backup/...and GitOps health checks silently no-op. (Also in.planning/codebase/CONCERNS.md.)- No Prometheus metrics. No way to answer "which databases haven't had a successful backup in 24h?" across a fleet.
- No Events. Failures live only in logs + status;
kubectl get eventsshows nothing.
Proposed work
O1 — Populate Conditions
In reconcileJobStatus, set standard Conditions via apimeta.SetStatusCondition with observedGeneration:
Scheduled(CronJob exists/matches spec),Ready(last run succeeded / False on failure),Degraded(≥N consecutive failures),BackupVerified(when verification lands). Unblockskubectl waitand Argo/Flux health.
O2 — Prometheus metrics
Register collectors with the controller-runtime metrics registry, labeled namespace + backup:
gobackup_backup_last_success_timestamp_seconds{namespace,backup} gauge
gobackup_backup_last_run_timestamp_seconds{namespace,backup} gauge
gobackup_backup_runs_total{namespace,backup,phase} counter
gobackup_backup_consecutive_failures{namespace,backup} gauge
gobackup_backup_duration_seconds{namespace,backup} histogram
Values already exist in reconcileJobStatus (SuccessCount, FailureCount, timestamps, phase). The operator already exposes a metrics endpoint (config/prometheus), so this is mostly wiring. Reset a Backup's series on deletion (finalizer/GC) to avoid stale gauges.
O3 — Events
Inject record.EventRecorder and emit on transitions: BackupSucceeded, BackupFailed, CronJobRecreated, ConfigInvalid.
O4 — Ship the alerting (helm, values-gated)
ServiceMonitor/PodMonitorfor the operator metrics endpoint.PrometheusRule:GoBackupBackupFailed(consecutive_failures ≥1 for >15m),GoBackupBackupTooOld(now − last_success > 26h),GoBackupNoRecentRun(scheduled but no run in 2× interval).- Starter Grafana dashboard (fleet table: backup, last-success age, failures, last duration).
Phases
- O1 Conditions + O3 Events — no new infra, unblocks
kubectl wait+ visibility. - O2 metrics + series GC on delete.
- O4 ServiceMonitor + PrometheusRule + dashboard (off by default).
Risks
- Cardinality: labels limited to
namespace+backup(+ boundedphase); never per-run/job. - Stale series: must reset metrics on Backup deletion (ties to missing-finalizer item in CONCERNS).
- Condition churn: only write on real transitions (reuse the existing same-phase guard).
Success criteria
kubectl wait --for=condition=Ready backup/xworks.- A Prometheus query lists every Backup whose last success is >24h old, cluster-wide.
- Failures appear as Events and fire a default alert within 15 minutes.
- Deleting a Backup removes its metric series.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with reconcileJobStatus and BackupStatus.Conditions in api/v1/backup_types.go, then inspect the existing metrics endpoint under config/prometheus. Review how the operator handles status transitions, deletion, and controller-runtime wiring before separating the Conditions, Events, metrics, and Helm alerting phases. Done means the listed conditions, events, metrics, series cleanup, and values-gated monitoring resources meet the stated success criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, grafana, helm, kubernetes, prometheus
- Domain
- devops, infrastructure, observability-sre
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100