Skip to content
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

Merged
merged 12 commits into from
Sep 19, 2024

Conversation

aruiz14
Copy link
Contributor

@aruiz14 aruiz14 commented Aug 22, 2024

Issue: rancher/rancher#46783

Includes the following improvements:

Example:
Screenshot 2024-08-22 at 08 47 33
(note for every ctx were set from rancher and can be changed)

@moio
Copy link
Contributor

moio commented Aug 22, 2024

It is my understanding that all current lasso metrics are gated behind the CATTLE_PROMETHEUS_METRICS environment variable.

Should startMetricsCollection honor it too?

Copy link
Contributor

@bigkevmcd bigkevmcd left a 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

@aruiz14 aruiz14 requested a review from bigkevmcd August 22, 2024 13:24
moio
moio previously approved these changes Aug 23, 2024
Copy link
Contributor

@moio moio left a 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)
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@aruiz14 aruiz14 requested a review from bigkevmcd August 27, 2024 12:31
bigkevmcd
bigkevmcd previously approved these changes Aug 27, 2024
moio
moio previously approved these changes Aug 28, 2024
@MKlimuszka MKlimuszka requested a review from tomleb September 5, 2024 16:20
@aruiz14 aruiz14 dismissed stale reviews from bigkevmcd and moio via 1a5d2f9 September 12, 2024 06:45
@aruiz14 aruiz14 requested a review from moio September 12, 2024 06:45
moio
moio previously approved these changes Sep 12, 2024
moio
moio previously approved these changes Sep 12, 2024
* Is updated frequently
* Can be split by context, by calling `WithContextID` over the
  `context.Context` passed to `Start`
* Deleted when cache is stopped
Copy link
Contributor

@bigkevmcd bigkevmcd left a 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 😄

@aruiz14
Copy link
Contributor Author

aruiz14 commented Sep 18, 2024

@tomleb merging is restricted, could you please push the button whenever it suits you best? Thanks!

@moio moio merged commit cf7a2ba into rancher:master Sep 19, 2024
1 check passed
@aruiz14 aruiz14 deleted the improve-cache-metrics branch September 19, 2024 08:05
moio added a commit to moio/rancher that referenced this pull request Oct 2, 2024

Verified

This commit was signed with the committer’s verified signature.
moio Silvio Moioli
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants