Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basebackup progress reporting metrics using pg_stat_progress_basebackup #1113

Open
kumar1202 opened this issue Jan 15, 2025 · 0 comments
Open

Comments

@kumar1202
Copy link

kumar1202 commented Jan 15, 2025

Proposal

Use case. Why is this important?

Majority of PG backups or standby cluster creation processes take place via the pg_basebackup process, where the given backup/standby cluster initiates the backup process and then the backup is streamed to the given cluster/s.

Some of these PostgreSQL clusters can range from GBs to TBs to even PBs. The PG tool, pg_stat_progress_basebackup was introduced in PG 13 and the data it provides should be exposed as prometheus metrics for DBAs, DevOps folks to monitor their standby cluster creation or backup processes.

We can create five main metrics:

  • pg_basebackup_bytes_total: For tracking total bytes to be streamed
  • pg_basebackup_bytes_streamed: For tracking amount of bytes that have been streamed
  • pg_basebackup_tablespaces_total: For tracking total count of tablespace to be streamed
  • pg_basebackup_tablespaces_streamed: For tracking count of tablespace that have been streamed
  • pg_basebackup_phase: Phase of the basebackup process

and can put the label as follows:

  • pid: As a label because there could be multiple concurrent backups

Along with other global labels to be used as cluster identifiers.

The basebackup phase can be numerically coded as follows to emit the phase metric as a number instead:

INITIALIZING = 0
WAITING_FOR_CHECKPOINT = 1
ESTIMATING_BACKUP_SIZE = 2
STREAMING_DB_FILES = 3
WAITING_FOR_WAL_ARCHIVE = 4
TRANSFERRING_WAL = 5

Folks, let me know if this sounds like a useful proposal and I'll be down to present the implementation for the same. Also please point out if there is any error in this implementation idea or if I've missed something. Thanks in advance!

@kumar1202 kumar1202 changed the title Basebackup Progress Reporting Metrics using pg_stat_progress_basebackup Basebackup progress reporting metrics using pg_stat_progress_basebackup Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant