-
Notifications
You must be signed in to change notification settings - Fork 55
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
feat(metrics): improve lasso_controller_total_cached_object #95
Conversation
1aa983e
to
e6d0525
Compare
It is my understanding that all current lasso metrics are gated behind the Should |
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'd like to see tests added for this?
Might wanna checkout https://pkg.go.dev/github.com/prometheus/client_golang/prometheus/testutil
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. As @bigkevmcd remarked, it would be best to have some kind of testing around this.
} | ||
|
||
ctx, cancel := context.WithCancel(context.Background()) | ||
t.Cleanup(cancel) |
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're calling cancel
later in the code?
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.
Yes, cancelling the same context twice is harmless, and eliminates the chance of the first assertion failing, so that t.Fatal
will make the cancel()
unreachable.
Also, it kind of hurts my eyes not seeing defer cancel()
after creating the context 😅 I used t.Cleanup
though to express it's actual cleanup.
1a5d2f9
to
b33ea5b
Compare
* Is updated frequently * Can be split by context, by calling `WithContextID` over the `context.Context` passed to `Start` * Deleted when cache is stopped
b33ea5b
to
1c9a1aa
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.
Thanks for the changes 😄
@tomleb merging is restricted, could you please push the button whenever it suits you best? Thanks! |
This includes various fixes to the UI Server-Side Pagination experimental feature: https://ranchermanager.docs.rancher.com/how-to-guides/advanced-user-guides/enable-experimental-features/ui-server-side-pagination - rancher/lasso#86 - rancher/lasso#90 - rancher/lasso#85 - rancher/lasso#92 - rancher/lasso#79 - rancher/lasso#97 - rancher/lasso#94 - rancher/lasso#98 - rancher/lasso#108 - rancher/lasso#99 It also includes improvements to code collecting metrics: - rancher/lasso#89 - rancher/lasso#95 And to test code: - rancher/lasso#100 - rancher/lasso#101 Signed-off-by: Silvio Moioli <silvio@moioli.net>
Issue: rancher/rancher#46783
Includes the following improvements:
WithContextID
over thecontext.Context
passed toStart
, see Improve lasso_controller_total_cached_object metrics rancher#46784Example:

(note for every
ctx
were set from rancher and can be changed)