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

sidecar, query, receiver: Native histogram support #6032

Merged
merged 8 commits into from
Jan 24, 2023

Conversation

rabenhorst
Copy link
Contributor

@rabenhorst rabenhorst commented Jan 10, 2023

Add native histogram support for sidecar, query, receiver. It does not include necessary changes for query UI and query frontend. The plan is to do this separate PRs. Relates to #5907.

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

Changes

  • Added native histogram to prompb and storepb types (including helper/conversion functions)
  • Implemented native histogram appending in receiver writer
  • Implemented native histogram support for related iterators

Verification

  • Native histogram e2e tests to test query (including dedup) and write through sidecar and receiver
  • Added test and benchmark for native histogram for receiver write

@rabenhorst rabenhorst force-pushed the native-histograms branch 2 times, most recently from 831ee0c to 67a4190 Compare January 10, 2023 11:37
@rabenhorst rabenhorst marked this pull request as ready for review January 10, 2023 14:25
@yeya24 yeya24 mentioned this pull request Jan 11, 2023
7 tasks
cmd/thanos/receive.go Outdated Show resolved Hide resolved
@rabenhorst rabenhorst force-pushed the native-histograms branch 2 times, most recently from 57c9771 to 8edbf72 Compare January 12, 2023 13:57
pkg/store/prometheus.go Outdated Show resolved Hide resolved
Copy link
Contributor

@fpetkovski fpetkovski left a comment

Choose a reason for hiding this comment

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

Looks good, thanks. Just one comment from my side

test/e2e/native_histograms_test.go Outdated Show resolved Hide resolved
@@ -843,7 +843,6 @@ func (s *mockedSeriesIterator) At() (t int64, v float64) {
return sample.t, sample.v
}

// TODO(rabenhorst): Needs to be implemented for native histogram support.
func (s *mockedSeriesIterator) AtHistogram() (int64, *histogram.Histogram) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I see we still panic in this method but removed the comment. Do we still need to implement anything?

Copy link
Contributor Author

@rabenhorst rabenhorst Jan 16, 2023

Choose a reason for hiding this comment

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

I will restore the comment. Rn mockedSeriesIterator does not support histograms and if we need it it needs to be implemented.

cmd/thanos/receive.go Show resolved Hide resolved
@rabenhorst
Copy link
Contributor Author

I updated prometheus/common so that it includes prometheus/common#417, which is not tagged yet but helps to improve tests (see last commit).

@rabenhorst rabenhorst force-pushed the native-histograms branch 3 times, most recently from c938a32 to ca26c93 Compare January 16, 2023 16:07
fpetkovski
fpetkovski previously approved these changes Jan 17, 2023
Copy link
Contributor

@fpetkovski fpetkovski left a comment

Choose a reason for hiding this comment

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

Thanks, this looks good now 👍

fpetkovski
fpetkovski previously approved these changes Jan 19, 2023
Copy link
Member

@GiedriusS GiedriusS left a comment

Choose a reason for hiding this comment

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

LGTM, just a nit

pkg/query/iter.go Outdated Show resolved Hide resolved
lastUseA := it.useA
defer func() {
if it.useA != lastUseA {
if it.useA != lastUseA && isFloatVal {
Copy link
Member

Choose a reason for hiding this comment

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

adjustAtValue seems to already be protected against doing something with non-float values but this makes code clearer 👍

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Added comment

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Cleanup native histogram tests

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Made native hist test ha and replace usage of at with att

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Fix deduplication with native histograms

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Enabled native histogram writing

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Committed missing files for write

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Added benchmark for histogram writing

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Fixed chunkSeriesIterator

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Enabled replication for native histogram write test

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Lint native histogram test imports

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Removed ToDo comments

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Cleanup

Signed-off-by: Sebastian Rabenhorst <[email protected]>
Signed-off-by: Sebastian Rabenhorst <[email protected]>
Signed-off-by: Sebastian Rabenhorst <[email protected]>
Signed-off-by: Sebastian Rabenhorst <[email protected]>
Signed-off-by: Sebastian Rabenhorst <[email protected]>
Signed-off-by: Sebastian Rabenhorst <[email protected]>
@GiedriusS GiedriusS merged commit 071b827 into thanos-io:main Jan 24, 2023
sshantel pushed a commit to sshantel/thanos that referenced this pull request Jan 28, 2023
* Added native histogram support for sidecar, query, receiver.

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Added comment

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Cleanup native histogram tests

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Made native hist test ha and replace usage of at with att

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Fix deduplication with native histograms

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Enabled native histogram writing

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Committed missing files for write

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Added benchmark for histogram writing

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Fixed chunkSeriesIterator

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Enabled replication for native histogram write test

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Lint native histogram test imports

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Removed ToDo comments

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Cleanup

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Renamed lastValue of dedup iter and added TODO

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Fixed typo

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Added hidden native histogram flag for receive tsdb

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* merge

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Comments and reverted change to qfe

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Go mod tidy

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Dedup iter nit

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Signed-off-by: Sebastian Rabenhorst <[email protected]>
ngraham20 pushed a commit to ngraham20/thanos that referenced this pull request Apr 17, 2023
* Added native histogram support for sidecar, query, receiver.

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Added comment

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Cleanup native histogram tests

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Made native hist test ha and replace usage of at with att

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Fix deduplication with native histograms

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Enabled native histogram writing

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Committed missing files for write

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Added benchmark for histogram writing

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Fixed chunkSeriesIterator

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Enabled replication for native histogram write test

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Lint native histogram test imports

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Removed ToDo comments

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Cleanup

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Renamed lastValue of dedup iter and added TODO

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Fixed typo

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Added hidden native histogram flag for receive tsdb

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* merge

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Comments and reverted change to qfe

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Go mod tidy

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Dedup iter nit

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Signed-off-by: Sebastian Rabenhorst <[email protected]>
ngraham20 pushed a commit to ngraham20/thanos that referenced this pull request Apr 17, 2023
* Added native histogram support for sidecar, query, receiver.

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Added comment

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Cleanup native histogram tests

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Made native hist test ha and replace usage of at with att

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Fix deduplication with native histograms

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Enabled native histogram writing

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Committed missing files for write

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Added benchmark for histogram writing

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Fixed chunkSeriesIterator

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Enabled replication for native histogram write test

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Lint native histogram test imports

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Removed ToDo comments

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Cleanup

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Renamed lastValue of dedup iter and added TODO

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Fixed typo

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Added hidden native histogram flag for receive tsdb

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* merge

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Comments and reverted change to qfe

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Go mod tidy

Signed-off-by: Sebastian Rabenhorst <[email protected]>

* Dedup iter nit

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Signed-off-by: Sebastian Rabenhorst <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants