[TraceQL Metrics] Add local disk caching for generator completed blocks#3799
Merged
mdisibio merged 6 commits intografana:mainfrom Jun 21, 2024
Merged
[TraceQL Metrics] Add local disk caching for generator completed blocks#3799mdisibio merged 6 commits intografana:mainfrom
mdisibio merged 6 commits intografana:mainfrom
Conversation
…leanup/dedupe timerange logic.
mapno
reviewed
Jun 21, 2024
mapno
approved these changes
Jun 21, 2024
mapno
pushed a commit
that referenced
this pull request
Jun 24, 2024
…ks (#3799) * working version * Fix start/end meta of generator-flushed blocks, and config default. Cleanup/dedupe timerange logic. * Add tests * lint * changelog * review feedback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this PR does:
Generators service metrics queries against recent data, which is done frequently and sensitive to user-facing performance. This adds a cache of query responses for local completed blocks which is typically the last 5-20 minutes.
The generators already have a similar cache for the metrics summary api, but this takes a different approach. Whereas the summary api cache is in-memory, this is disk-based and writes new caching files to the block folder. These files are unique to each request (query + params), and exist for the lifetime of the block. They aren't flushed to object storage, and they get automatically cleaned up when the block is deleted. (Note - this has precedent in the
flushedfile that is written to block folders to track their flushed status) Reasons to avoid the in-memory cache is that generators are already usually memory-intensive, and the cache is often inadequate as-is. Example block contents:There are additional changes in this PR which proved necessary:
Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]