-
Notifications
You must be signed in to change notification settings - Fork 812
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 concurrency to the mergeQueryable #4065
Add concurrency to the mergeQueryable #4065
Conversation
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.
LGTM, just 1 question and some smaller doc string changes
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 nice - just one suggestion which might simplify the code a bit.
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 work, thank you on working on this. I suggest we simplify mergeDistinctStringSlice
a bit (see my comments).
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.
@simonswine can you add an enhancement CHANGELOG entry?
e203f2b
to
0fc0fcd
Compare
ff839dc
to
82e9c65
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.
Thank you for your work on this. Please take a look at comments.
833a7f9
to
13acdf4
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.
Nice work! Thanks for addressing my feedback.
q := mockTenantQuerier{tenant: tenantIDs[0], extraLabels: m.extraLabels} | ||
|
||
// set warning if exists | ||
if intf := ctx.Value(contextKeyWarningsByTenant); intf != nil { |
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.
Nit: I don't quite see why warnings and errors for tenants must be passed to mockTenantQueryableWithFilter
via context, instead of having extra fields in that queryable.
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.
Valid point, have refactored the tests a bit in 4a10de0
@pstibrany thanks for your continued review 🤗, we should be there now. |
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.
LGTM
I had one question and two nits. Both non-blocking.
8c5a8f9
to
ffb1313
Compare
This should significantly parallelize tenant federation queries. This also extends aligns the error and warning wrapping and adds tests for those cases. Signed-off-by: Christian Simon <[email protected]>
Co-authored-by: Steve Simpson <[email protected]> Co-authored-by: Michel Hollands <[email protected]> Signed-off-by: Christian Simon <[email protected]>
* Avoid background goroutine receiving results * Propagate errGroup context * Improve documentation comments Signed-off-by: Christian Simon <[email protected]>
Signed-off-by: Christian Simon <[email protected]>
In the first instance the limit is hard-coded, but that might be an option that can configured. Signed-off-by: Christian Simon <[email protected]>
Signed-off-by: Christian Simon <[email protected]>
This is beneficial if the methods are not handling context cancellation themselves. Signed-off-by: Christian Simon <[email protected]>
Signed-off-by: Christian Simon <[email protected]>
Signed-off-by: Christian Simon <[email protected]>
Signed-off-by: Christian Simon <[email protected]>
Reuse queryable struct and avoid using the context for passing parameters around. Signed-off-by: Christian Simon <[email protected]>
Co-authored-by: Jacob Lisi <[email protected]> Signed-off-by: Christian Simon <[email protected]>
ffb1313
to
7fd543d
Compare
* Add concurrency to the mergeQueryable This should significantly parallelize tenant federation queries. This also extends aligns the error and warning wrapping and adds tests for those cases. Signed-off-by: Christian Simon <[email protected]> * Apply suggestions from code review Co-authored-by: Steve Simpson <[email protected]> Co-authored-by: Michel Hollands <[email protected]> Signed-off-by: Christian Simon <[email protected]> * Simplify concurrency of mergeDistinctStringSlice * Avoid background goroutine receiving results * Propagate errGroup context * Improve documentation comments Signed-off-by: Christian Simon <[email protected]> * Add changelog entry Signed-off-by: Christian Simon <[email protected]> * Limit maximum concurrency of mergeQueryable In the first instance the limit is hard-coded, but that might be an option that can configured. Signed-off-by: Christian Simon <[email protected]> * End job early if context already closed Signed-off-by: Christian Simon <[email protected]> * Handle context cancellation in concurrency.ForEach This is beneficial if the methods are not handling context cancellation themselves. Signed-off-by: Christian Simon <[email protected]> * Avoid using interface pointer Signed-off-by: Christian Simon <[email protected]> * Handle errors properly for storage.SeriesSet Signed-off-by: Christian Simon <[email protected]> * Improve warning and error message readability Signed-off-by: Christian Simon <[email protected]> * Simplify mockTenantQueryableWithFilter Reuse queryable struct and avoid using the context for passing parameters around. Signed-off-by: Christian Simon <[email protected]> * Improve wording on comment Co-authored-by: Jacob Lisi <[email protected]> Signed-off-by: Christian Simon <[email protected]> Co-authored-by: Steve Simpson <[email protected]> Co-authored-by: Michel Hollands <[email protected]> Co-authored-by: Jacob Lisi <[email protected]>
This should significantly parallelize tenant federation queries. This also extends and aligns the error and warning wrapping and adds tests for those cases.
What this PR does:
Which issue(s) this PR fixes:
Fixes #
Checklist
[ ] Documentation addedCHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]