Skip to content

Conversation

leizor
Copy link
Contributor

@leizor leizor commented Sep 30, 2022

Here's another attempt at closing #5926.

I noticed #8351 was stale, and I think this PR has a few improvements over it:

  • I believe the implementation of chunkSeriesIterator.Seek wasn't correct (it allowed for backwards seeking and does not seek past the current chunk).
  • I think I've simplified the implementations of chunkedSeriesSet, chunkedSeries, and chunkedSeriesIterator.
  • The sizeLimit parameter for the ChunkedReader used by the read client is configurable.
  • The read_queries_total and read_request_duration_seconds metrics have an added response_type label that track whether the response from the server was sampled or chunked.
  • The client filters returned samples in the chunked response that are outside of the queried range.

@leizor leizor force-pushed the leizor/streaming-remote-read branch 2 times, most recently from 6349bc9 to 714f69b Compare September 30, 2022 22:14
@leizor leizor marked this pull request as ready for review October 1, 2022 00:39
@leizor leizor force-pushed the leizor/streaming-remote-read branch 7 times, most recently from 5e7735f to 350226f Compare April 24, 2023 16:08
@codesome codesome removed their request for review April 28, 2023 21:41
@roidelapluie
Copy link
Member

cc @bwplotka can you please review this? Thanks

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Looks solid, thanks! 💪🏽

LGTM, just the issue with instrumentation of this. Streaming changes a little bit in semantics of those metrics. Let's ensure those metric remain useful.

@leizor leizor force-pushed the leizor/streaming-remote-read branch from e373a94 to d082eec Compare July 18, 2023 19:30
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Last nit, otherwise LGTM, thanks!

@@ -35,12 +35,23 @@ import (
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/trace"

"github.com/prometheus/prometheus/storage"

Copy link
Member

Choose a reason for hiding this comment

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

blank line not needed

prompb.ReadRequest_STREAMED_XOR_CHUNKS,
prompb.ReadRequest_SAMPLES,
}
)
Copy link
Member

Choose a reason for hiding this comment

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

Let's merge those var sections together?

@@ -66,10 +77,10 @@ var (
Namespace: namespace,
Subsystem: subsystem,
Name: "read_request_duration_seconds",
Help: "Histogram of the latency for remote read requests.",
Help: "Histogram of the latency for remote read requests. Note that for streamed responses this is only the duration of the initial call and does not include the processing of the stream.",
Copy link
Member

Choose a reason for hiding this comment

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

I wished we could actually move this to be full latency including receiving all bytes etc, but good enough for now I guess.

@leizor leizor force-pushed the leizor/streaming-remote-read branch 2 times, most recently from e70669b to 957b07e Compare July 26, 2023 20:02
@leizor
Copy link
Contributor Author

leizor commented Jul 26, 2023

Thanks for all the feedback @bwplotka!

@roidelapluie
Copy link
Member

cc @bwplotka can you look at this PR?

@leizor leizor force-pushed the leizor/streaming-remote-read branch 2 times, most recently from 18a0dac to 6f91a36 Compare October 18, 2023 23:14
@bwplotka
Copy link
Member

Ayay, sorry for delay. Will try to look this/next week. Thanks!

bwplotka
bwplotka previously approved these changes Mar 26, 2024
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Thanks, and sorry for lag. One non-blocking comment, otherwise LGTM, good to go.

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

I tried to rebase + resolve conflicts, but it seems it got sideways. Do you mind rebasing that one last time? Sorry!

@leizor leizor force-pushed the leizor/streaming-remote-read branch 2 times, most recently from dd088cc to 21891f6 Compare March 28, 2024 17:58
@leizor
Copy link
Contributor Author

leizor commented Mar 28, 2024

@bwplotka Yep, not a problem - done!

@leizor leizor force-pushed the leizor/streaming-remote-read branch from 870b1d8 to c6dec94 Compare April 26, 2024 17:57
leizor and others added 8 commits July 17, 2024 14:03
Signed-off-by: Justin Lei <justin.lei@grafana.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Justin Lei <justin.lei@grafana.com>
Signed-off-by: Justin Lei <lei.justin@gmail.com>
Signed-off-by: Justin Lei <lei.justin@gmail.com>
Signed-off-by: Justin Lei <lei.justin@gmail.com>
Signed-off-by: Justin Lei <lei.justin@gmail.com>
Signed-off-by: Justin Lei <lei.justin@gmail.com>
Signed-off-by: Justin Lei <lei.justin@gmail.com>
@leizor leizor force-pushed the leizor/streaming-remote-read branch from c6dec94 to 604a84e Compare July 17, 2024 22:35
Signed-off-by: Justin Lei <lei.justin@gmail.com>
@leizor leizor force-pushed the leizor/streaming-remote-read branch from 604a84e to a86b8f9 Compare July 17, 2024 22:37
Signed-off-by: Justin Lei <lei.justin@gmail.com>
@leizor leizor force-pushed the leizor/streaming-remote-read branch from 7dd71cf to 65ba5fa Compare July 17, 2024 23:13
@leizor
Copy link
Contributor Author

leizor commented Jul 17, 2024

@bwplotka I did another rebase/resolve conflicts cycle - would you mind taking a look again? Let me know if you'd like me to squash all the commits together or anything like that!

@leizor leizor requested a review from bwplotka July 18, 2024 17:41
@Kran001
Copy link

Kran001 commented Aug 26, 2024

Hello everyone!
Any news on this issue?

@beorn7
Copy link
Member

beorn7 commented Aug 27, 2024

I have tried to ping @bwplotka in other means. Sorry for the lag.

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Thanks for amazing work here.

Apologies for lags, but remote-read went outside of my immediate work scope, limiting my time here a bit. Solid code, thanks 💪🏽

@bwplotka bwplotka merged commit 3a82cd5 into prometheus:main Aug 28, 2024
c.readQueriesDuration.WithLabelValues("chunked").Observe(time.Since(start).Seconds())

s := NewChunkedReader(httpResp.Body, c.chunkedReadLimit, nil)
return NewChunkedSeriesSet(s, httpResp.Body, query.StartTimestampMs, query.EndTimestampMs, func(err error) {
Copy link
Contributor

@GiedriusS GiedriusS Aug 28, 2024

Choose a reason for hiding this comment

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

You need to buffer everything here due to #12605 + resort. Is this being done somewhere? I can't find it.

Copy link
Member

Choose a reason for hiding this comment

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

Those comments are hard to track - would you like to add a issue about this if there's some work to improve things here?

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.

7 participants