Skip to content

Commit f0d3221

Browse files
Merge pull request #549 from aiven/2.2.2-fix-metric
Ensure progress metric is updated frequently during basebackup [BF-956] #549
2 parents 17d9ac8 + ee97c0e commit f0d3221

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

pghoard/basebackup.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -718,11 +718,11 @@ def create_and_upload_chunks(
718718
# and this assumption greatly simplifies the logic.
719719
task_to_wait = pending_compress_and_encrypt_tasks.pop(0)
720720
chunk_files.append(task_to_wait.result())
721-
self.metrics.gauge(
722-
"pghoard.basebackup_estimated_progress",
723-
float(len(chunk_files) * 100 / len(chunks)),
724-
tags={"site": self.site}
725-
)
721+
self.metrics.gauge(
722+
"pghoard.basebackup_estimated_progress",
723+
float(len(chunk_files) * 100 / len(chunks)),
724+
tags={"site": self.site}
725+
)
726726
if self.chunks_on_disk < max_chunks_on_disk:
727727
chunk_id = i + 1
728728
task = tpe.submit(
@@ -750,6 +750,8 @@ def create_and_upload_chunks(
750750
tags={"site": self.site}
751751
)
752752

753+
self.metrics.gauge("pghoard.basebackup_estimated_progress", float(100), tags={"site": self.site})
754+
753755
while len(upload_results) < len(chunk_files):
754756
self.wait_for_chunk_transfer_to_complete(len(chunks), upload_results, chunk_callback_queue, start_time)
755757

0 commit comments

Comments
 (0)