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
base: main
Are you sure you want to change the base?
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.
Nice! Some suggestions + rebase needed, but overall LGTM.
Sorry for lag and thanks for amazing work!
storage/remote/client.go
Outdated
@@ -298,7 +309,11 @@ func (c *Client) Read(ctx context.Context, query *prompb.Query) (*prompb.QueryRe | |||
httpReq.Header.Set("X-Prometheus-Remote-Read-Version", "0.1.0") | |||
|
|||
ctx, cancel := context.WithTimeout(ctx, c.timeout) | |||
defer cancel() | |||
defer func() { |
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.
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.
Good point - will do!
storage/remote/client.go
Outdated
return FromQueryResult(sortSeries, res), nil | ||
} | ||
|
||
func (c *Client) handleChunkedResponse(httpResp *http.Response, mint, maxt int64, cancel func(error)) storage.SeriesSet { |
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 inline this method to the caller, too shallow to have it TBH
6049a11
to
09bca48
Compare
@bwplotka Thanks for all the feedback, I believe this is now ready to merge! |
@bwplotka did this fall through the cracks? Could you have a look? |
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!
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>
dd088cc
to
21891f6
Compare
@bwplotka Yep, not a problem - done! |
Signed-off-by: Justin Lei <lei.justin@gmail.com>
Signed-off-by: Justin Lei <lei.justin@gmail.com>
870b1d8
to
c6dec94
Compare
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
.