-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
query: Add Store timeout to Thanos Query #920
Conversation
0892fc5
to
4f385bd
Compare
…lure when one of stores timed out
Co-Authored-By: d-ulyanov <[email protected]>
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.
Minor nits really, generally I like this! Thanks (:
@@ -10,7 +10,7 @@ NOTE: As semantic versioning states all 0.y.z releases can contain breaking chan | |||
We use *breaking* word for marking changes that are not backward compatible (relates only to v0.y.z releases.) | |||
|
|||
## Unreleased | |||
|
|||
- [#920](https://github.com/improbable-eng/thanos/pull/920) Add Thanos store.read-timeout. Maximum time to read response from store, which defaults to 2 minutes. If request to one of stores is timed out and store.read-timeout < query.timeout partial response will be returned. If store.read-timeout >= query.timeout one of stores is timed out the client will get no data and timeout 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.
Move it to Added
section and remove add
word
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.
partial response will be returned
(if partial response is enabled)
queryMaxDuration := time.Duration(*queryTimeout) | ||
storeReadMaxDuration := time.Duration(*storeReadTimeout) | ||
|
||
if storeReadMaxDuration > queryMaxDuration { |
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 remove that. Context
logic already ensures that
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.
+1
@@ -270,5 +270,12 @@ Flags: | |||
if no max_source_resolution param is specified. | |||
--query.partial-response Enable partial response for queries if no | |||
partial_response param is specified. | |||
--store.read-timeout=2m Maximum time to read response from store. If |
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.
same here (mention about disabling partial response)
storeClient := &store.ClientMock{ | ||
StoreClientMock: &storepb.StoreClientMock{ | ||
SeriesCallback: func(ctx context.Context, in *storepb.SeriesRequest, opts ...grpc.CallOption) (storepb.Store_SeriesClient, error) { | ||
// Just wait for ctx.Done() as it works internally in GRPC StoreClient |
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.
missing trailing period
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.
also I would remove this, I think it's obvious.
@@ -274,6 +277,54 @@ func TestDedupSeriesIterator(t *testing.T) { | |||
} | |||
} | |||
|
|||
func TestQuerier_StoreReadTimeout(t *testing.T) { | |||
storeClient := &store.ClientMock{ |
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 would be more comfortable if this test would have also another client that actually serves some metrics after 100 miliseconds.
} | ||
|
||
storeReadTimeout := 1 * time.Millisecond | ||
queryTimeout := 1 * time.Second |
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 make it longer otherwise slow CI will make this test flaky
|
||
select { | ||
case <-storeQueryDone: | ||
// Do nothing - storeQuery expected to finish first |
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.
missing trailing periods at the end
import "github.com/improbable-eng/thanos/pkg/store/storepb" | ||
|
||
// ClientMock is a structure for mocking storepb.Client interface | ||
type ClientMock struct { |
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 think you can move it to mock_test.go
file instead
@@ -51,7 +51,7 @@ func TestProxyStore_Info(t *testing.T) { | |||
q := NewProxyStore(nil, | |||
func() []Client { return nil }, | |||
component.Query, | |||
nil, | |||
nil, 100*time.Second, |
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.
2 * time.Minute?
) | ||
|
||
// StoreClientMock is a structure for mocking StoreClient interface | ||
type StoreClientMock struct { |
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 don't think this is necessary. See my comment here: #895 (comment)
@povilasv this diff seems strange, I see mock.go here (I've removed it) and some changes that I've removed too. Lets re-create PR pls, don't you mind? |
@d-ulyanov your PR is all good now, was outdated when I started doing mine. So let's just use yours. |
Okay, cool, thanks @povilasv |
Changes
Taking over #895 as I'm affected by it too #919
@d-ulyanov has done a great job and only one thing left from that PR to fix, which I'm fixing here:
#895 (comment)
I move time out from querier to proxy