woblerr opened a new pull request, #87:
URL: https://github.com/apache/cloudberry-backup/pull/87

   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](https://github.com/woblerr/gpbackup_exporter) project and 
has been adapted for integration into the cloudberry-backup repository.
   
   ## Motivation
   
   gpbackup does not expose built-in Prometheus metrics. `gpbackup_exporter` 
fills this gap. This allows integrating backup health monitoring into existing 
Prometheus/Grafana stacks.
   
   ## Features
   
   `gpbackup_exporter` exposes 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:
   
   ```bash
   $ make unit
   
   [1776080594] TOC Suite - 45/45 specs 
••••••••••••••••••••••••••••••••••••••••••••• SUCCESS! 2.217417ms PASS
   [1776080594] testutils tests - 8/8 specs •••••••• SUCCESS! 552.083µs PASS
   [1776080594] Textmsg Suite - 14/14 specs •••••••••••••• SUCCESS! 604.292µs 
PASS
   [1776080594] Gpbckpconfig Suite - 47/47 specs 
••••••••••••••••••••••••••••••••••••••••••••••• SUCCESS! 1.909583ms PASS
   [1776080594] utils tests - 118/118 specs 
••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
 SUCCESS! 103.433167ms PASS
   [1776080594] restore tests - 118/118 specs 
••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
 SUCCESS! 85.166959ms PASS
   [1776080594] Cmd Suite - 14/14 specs •••••••••••••• SUCCESS! 3.561667ms PASS
   [1776080594] Filepath Suite - 31/31 specs ••••••••••••••••••••••••••••••• 
SUCCESS! 2.903958ms PASS
   [1776080594] Options Suite - 27/27 specs ••••••••••••••••••••••••••• 
SUCCESS! 6.135125ms PASS
   [1776080594] Exporter Suite - 37/37 specs 
••••••••••••••••••••••••••••••••••••• SUCCESS! 18.97375ms PASS
   [1776080594] History Suite - 8/8 specs •••••••• SUCCESS! 15.766416ms PASS
   [1776080594] Report Suite - 34/34 specs •••••••••••••••••••••••••••••••••• 
SUCCESS! 9.29725ms PASS
   [1776080594] s3_plugin tests - 32/32 specs •••••••••••••••••••••••••••••••• 
SUCCESS! 4.222791ms PASS
   [1776080594] backup tests - 585/586 specs 
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••S••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••S••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
 
••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••S••••••••••••••••••••••••••••••••S••••••••••••••••••••••P••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••S••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••S••
 SUCCESS! 172.169042ms PASS
   
   Ginkgo ran 14 suites in 10.961838459s
   Test Suite Passed
   ```
   
   ## Open Questions
   
   1. The exporter uses `promslog` for logging, which outputs in `logfmt` or 
`json` format — the standard for Prometheus exporters. Other tools in this 
repository use `gplog` from `cloudberry-go-libs`. Should `gpbackup_exporter` be 
migrated to `gplog` for consistency, or is it acceptable to keep the Prometheus 
logger?
   
   2. The exporter's `Makefile` targets use additional `-ldflags` 
(`GIT_REVISION`, `GIT_BRANCH`, `BUILD_DATE`) injected into 
`github.com/prometheus/common/version`. This is required by the Prometheus 
exporter convention to populate `gpbackup_exporter_build_info` metric. Other 
tools in the repo use a simpler single `-X version=...` flag pattern. Is this 
acceptable?
   
   ## Related links
   
   - 
https://github.com/apache/cloudberry-backup/issues/80#issuecomment-4170215979
   - Original project: 
[gpbackup_exporter](https://github.com/woblerr/gpbackup_exporter)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to