thanos icon indicating copy to clipboard operation
thanos copied to clipboard

feat(compact): Add Pushgateway metrics support for one-shot runs

Open elohmeier opened this issue 3 months ago • 2 comments

  • [x] I added CHANGELOG entry for this change.
  • [ ] Change is not relevant to the end user.

Changes

This change introduces the ability for the thanos compact command to push its metrics to a Prometheus Pushgateway when running in one-shot mode (without the --wait flag).

This is particularly useful for monitoring the compactor when it is run as a periodic batch job, such as a cron job.

The following changes have been made:

  • Refactored progress metric calculation to run in one-shot mode.
  • Added --push-gateway.url and --push-gateway.job flags to configure the Pushgateway endpoint and job name.
  • Implemented the logic to push all registered metrics upon successful completion of a one-shot compaction run.

Verification

I've tested the metrics availability in the --wait mode and with a Pushgateway.

elohmeier avatar Sep 15 '25 11:09 elohmeier

Added CHANGELOG entry.

elohmeier avatar Sep 15 '25 11:09 elohmeier

Docs CI failure is unrelated, I've pushed a fix here: https://github.com/thanos-io/thanos/pull/8494

elohmeier avatar Sep 17 '25 02:09 elohmeier