Skip to content

Commit

Permalink
Ensure progress metric is updated frequently during basebackup
Browse files Browse the repository at this point in the history
  • Loading branch information
nicois authored and alexole committed Aug 17, 2022
1 parent 17d9ac8 commit ee97c0e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pghoard/basebackup.py
Expand Up @@ -718,11 +718,11 @@ def create_and_upload_chunks(
# and this assumption greatly simplifies the logic.
task_to_wait = pending_compress_and_encrypt_tasks.pop(0)
chunk_files.append(task_to_wait.result())
self.metrics.gauge(
"pghoard.basebackup_estimated_progress",
float(len(chunk_files) * 100 / len(chunks)),
tags={"site": self.site}
)
self.metrics.gauge(
"pghoard.basebackup_estimated_progress",
float(len(chunk_files) * 100 / len(chunks)),
tags={"site": self.site}
)
if self.chunks_on_disk < max_chunks_on_disk:
chunk_id = i + 1
task = tpe.submit(
Expand Down Expand Up @@ -750,6 +750,8 @@ def create_and_upload_chunks(
tags={"site": self.site}
)

self.metrics.gauge("pghoard.basebackup_estimated_progress", float(100), tags={"site": self.site})

while len(upload_results) < len(chunk_files):
self.wait_for_chunk_transfer_to_complete(len(chunks), upload_results, chunk_callback_queue, start_time)

Expand Down

0 comments on commit ee97c0e

Please sign in to comment.