Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time based downsampling during compaction #2880

Merged
merged 25 commits into from
Jan 8, 2024
Merged

Time based downsampling during compaction #2880

merged 25 commits into from
Jan 8, 2024

Conversation

aleks-p
Copy link
Contributor

@aleks-p aleks-p commented Dec 27, 2023

An early and unoptimized implementation of time-based downsampling.

Notes:

  • parquet files containing downsampled profiles are stored alongside profiles.parquet in the same compacted blocks (see pkg/phlaredb/downsample/downsample_test.go for an example)
  • two resolutions for now (5m and 1h), hardcoded
  • raw source data is used for all resolutions (no chaining of source -> 5m -> 1h)

Opening this PR to get early feedback about the general direction. See #2118 for more information.

Copy link
Collaborator

@kolesnikovae kolesnikovae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work @aleks-p! I'm gong to update block querier to use the downsampled data wherever possible

pkg/phlaredb/downsample/downsample.go Outdated Show resolved Hide resolved
pkg/phlaredb/schemas/v1/profiles.go Outdated Show resolved Hide resolved
pkg/phlaredb/schemas/v1/profiles.go Outdated Show resolved Hide resolved
pkg/phlaredb/downsample/downsample.go Outdated Show resolved Hide resolved
pkg/phlaredb/downsample/downsample.go Outdated Show resolved Hide resolved
pkg/phlaredb/downsample/downsample.go Outdated Show resolved Hide resolved
pkg/phlaredb/downsample/downsample.go Outdated Show resolved Hide resolved
pkg/phlaredb/downsample/downsample.go Show resolved Hide resolved
@kolesnikovae
Copy link
Collaborator

One more thing we may want to add later: compaction should be aware of downsampled data and use them if available. This is only useful, if multiple compaction ranges are configured

@aleks-p aleks-p changed the title [WIP] Downsampling during compaction (write path) Time based downsampling during compaction (write path) Jan 5, 2024
@aleks-p aleks-p marked this pull request as ready for review January 5, 2024 18:46
@aleks-p aleks-p requested review from a team as code owners January 5, 2024 18:46
aleks-p and others added 2 commits January 5, 2024 15:40
* feat: add downsampled tables to block querier

* add low res profile source

* fix lint issues

* better heuristic

* time range split with resolutions

* read downsampled tables concurrently

* add SplitTimeRangeByResolution tests

* Fix test (avg is not supported currently)

* add basic metric to track table access

* reuse WithPartitionSamples

* fix store-gateway metrics registration

* Update pkg/util/time.go

* fix store-gateway metrics multi-tenancy

* post-review updates

* fix metric registration in ingester

* Fix failing test

* go mod tidy

---------

Co-authored-by: Aleksandar Petrov <8142643+aleks-p@users.noreply.github.com>
Copy link
Collaborator

@kolesnikovae kolesnikovae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏻

# Conflicts:
#	pkg/phlaredb/compact.go
@aleks-p aleks-p changed the title Time based downsampling during compaction (write path) Time based downsampling during compaction Jan 8, 2024
@aleks-p aleks-p merged commit c6646db into main Jan 8, 2024
19 checks passed
@aleks-p aleks-p deleted the feat/downsampler branch January 8, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants