Allow Prometheus/TSDB blocks from multiple sources #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds flag to Prometheus that enables vertical compaction and makes it possible to copy data from multiple Prometheus instances without manually rewriting the database: simply copy blocks from one Prometheus data directory to the target Prometheus data directory.
For example, Prometheus data directories usually look like this:
In this case the first 3 subdirectories starting with
01HQ*
are blocks that have been compacted.The main caveat is this works well enough for already compacted TSDB blocks, but it doesn't work for the head block (the block that holds the most recent data), and so there is a chance we are losing the last ~2 hours of the Prometheus databases we are merging.
It would be ideal if we can simply flush the head block with the Prometheus API or with promtool. There are a number of proposals, but nothing that looks like it has made it to Prometheus yet.
Alternatives I'm thinking of are playing with snapshots to force writing the head block, or forcing it directly with a custom tool that calls
FlushWAL()
on the Prometheus database.While not perfect, this approach to combining multiple Prometheus databases is more promising than anything else I've seen so far.