-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Add streaming remote read to ReadClient #11379
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
Add streaming remote read to ReadClient #11379
Conversation
6349bc9
to
714f69b
Compare
5e7735f
to
350226f
Compare
cc @bwplotka can you please review this? Thanks |
There was a problem hiding this 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.
e373a94
to
d082eec
Compare
There was a problem hiding this 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!
storage/remote/client.go
Outdated
@@ -35,12 +35,23 @@ import ( | |||
"go.opentelemetry.io/otel" | |||
"go.opentelemetry.io/otel/trace" | |||
|
|||
"github.com/prometheus/prometheus/storage" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line not needed
storage/remote/client.go
Outdated
prompb.ReadRequest_STREAMED_XOR_CHUNKS, | ||
prompb.ReadRequest_SAMPLES, | ||
} | ||
) |
There was a problem hiding this comment.
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?
storage/remote/client.go
Outdated
@@ -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.", |
There was a problem hiding this comment.
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.
e70669b
to
957b07e
Compare
Thanks for all the feedback @bwplotka! |
cc @bwplotka can you look at this PR? |
18a0dac
to
6f91a36
Compare
Ayay, sorry for delay. Will try to look this/next week. Thanks! |
There was a problem hiding this 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.
There was a problem hiding this 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!
dd088cc
to
21891f6
Compare
@bwplotka Yep, not a problem - done! |
870b1d8
to
c6dec94
Compare
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>
c6dec94
to
604a84e
Compare
Signed-off-by: Justin Lei <lei.justin@gmail.com>
604a84e
to
a86b8f9
Compare
7dd71cf
to
65ba5fa
Compare
@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! |
Hello everyone! |
I have tried to ping @bwplotka in other means. Sorry for the lag. |
There was a problem hiding this 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 💪🏽
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
Here's another attempt at closing #5926.
I noticed #8351 was stale, and I think this PR has a few improvements over it:
chunkSeriesIterator.Seek
wasn't correct (it allowed for backwards seeking and does not seek past the current chunk).chunkedSeriesSet
,chunkedSeries
, andchunkedSeriesIterator
.sizeLimit
parameter for theChunkedReader
used by the read client is configurable.read_queries_total
andread_request_duration_seconds
metrics have an addedresponse_type
label that track whether the response from the server wassampled
orchunked
.