thanos icon indicating copy to clipboard operation
thanos copied to clipboard

tools bucket: Add ability to discover external labels from prometheus address for `upload-blocks`

Open Nashluffy opened this issue 10 months ago • 1 comments

Is your proposal related to a problem?

thanos tools bucket upload-blocks is very useful, but having to specify the external labels via --label is tedious and error-prone.

My use-case for upload-blocks is on thanos-sidecar shutdown, I want to ensure all blocks are "flushed" to the bucket. In this case, I'd rather just point at the prometheus instance and have it discover external labels from there, similar to how thanos sidecar discovers the external labels.

Describe the solution you'd like

thanos tools bucket upload-blocks --prometheus.url="localhost:9090" would discover external labels in the exact same manner the sidecar does on start

Describe alternatives you've considered

I currently work around this by hitting prometheus directly for the config, and then formatting --label for each label.

Additional context

N/A

Nashluffy avatar Apr 20 '24 13:04 Nashluffy

Alternatively, if thanos sidecar “flushed”/performed one last Sync once it received SIGTERM, I would be able to do away with using this command altogether.

Nashluffy avatar Apr 20 '24 14:04 Nashluffy