Add gpbackup_exporter — a Prometheus exporter for gpbackup history database.#87
Open
woblerr wants to merge 6 commits intoapache:mainfrom
Open
Add gpbackup_exporter — a Prometheus exporter for gpbackup history database.#87woblerr wants to merge 6 commits intoapache:mainfrom
woblerr wants to merge 6 commits intoapache:mainfrom
Conversation
Introduce the Prometheus metrics exporter as a new standalone binary within the repository. - Create gpbackup_exporter.go entry point with CLI flags and collection loop. - Port core exporter logic to the new `exporter/` package. - Adapt type system to use `*history.BackupConfig` directly, aligning with the cloudberry-backup architecture. - Switch receiver methods to standalone gpbckpconfig helpers. - Add Prometheus and Kingpin dependencies to `go.mod`. - Update Makefile to support building, testing, and packaging. - Port unit tests to Ginkgo/Gomega.
Add e2e test that runs gpbackup commands and validates that gpbackup_exporter correctly reads history database and exposes metrics. Also remove dead gpbackmanPath assignment from useOldBackupVersion in e2e tests. And suppress noisy test logger output by writing to bytes.Buffer instead of os.Stdout in exporter unit tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added
gpbackup_exporter- a Prometheus exporter for collecting metrics from the gpbackup history database (gpbackup_history.db).It is based on the original gpbackup_exporter project and has been adapted for integration into the cloudberry-backup repository.
Motivation
gpbackup does not expose built-in Prometheus metrics.
gpbackup_exporterfills this gap. This allows integrating backup health monitoring into existing Prometheus/Grafana stacks.Features
gpbackup_exporterexposes the following Prometheus metrics:Backup metrics:
gpbackup_backup_status— backup status (success / failure);gpbackup_backup_deletion_status— backup deletion status;gpbackup_backup_info— backup info (version, compression, plugin, etc.);gpbackup_backup_duration_seconds— backup duration in seconds.Last backup metrics:
gpbackup_backup_since_last_completion_seconds— seconds elapsed since the last completed backup per database and backup type.Exporter self-metrics:
gpbackup_exporter_status— gpbackup exporter get data status;gpbackup_exporter_build_info— information about gpbackup exporter.Filtering flags:
--gpbackup.db-include/--gpbackup.db-exclude— limit collection to specific databases;--gpbackup.backup-type— limit collection to a specific backup type;--gpbackup.collect-deleted/--gpbackup.collect-failed— include deleted / failed backups;--collect.depth— collect metrics only for backups not older than N days;--web.config.file— TLS and basic authentication support via the Prometheus exporter toolkit.Verification
Unit tests pass without errors:
Open Questions
The exporter uses
promslogfor logging, which outputs inlogfmtorjsonformat — the standard for Prometheus exporters. Other tools in this repository usegplogfromcloudberry-go-libs. Shouldgpbackup_exporterbe migrated togplogfor consistency, or is it acceptable to keep the Prometheus logger?The exporter's
Makefiletargets use additional-ldflags(GIT_REVISION,GIT_BRANCH,BUILD_DATE) injected intogithub.com/prometheus/common/version. This is required by the Prometheus exporter convention to populategpbackup_exporter_build_infometric. Other tools in the repo use a simpler single-X version=...flag pattern. Is this acceptable?Related links