Skip to content

Commit

Permalink
Merge pull request #549 from aiven/2.2.2-fix-metric
Browse files Browse the repository at this point in the history
Ensure progress metric is updated frequently during basebackup [BF-956]

#549
  • Loading branch information
kmichel-aiven committed Aug 17, 2022
2 parents 17d9ac8 + ee97c0e commit f0d3221
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 f0d3221

Please sign in to comment.