Skip to content

Conversation

giorio94
Copy link
Member

@giorio94 giorio94 commented Oct 29, 2024

Slightly modify the service handler debug statement to skip the expensive computation of service-related log fields when debug logs are disabled, as not used at all. In particular, rendering services and endpoints into the corresponding string representation is demanding both in terms of CPU time and memory allocations. Passing the original object as parameter, rather than the stringified version, allows to delegate this operation to slog, which is then skipped if debug logs are disabled.

Additionally, let's also rework the warning log to only include the service name and namespace as parameter for simplicity, as it is never expected to occur (all temporary errors are retried internally).

Related: 52c06e1 ("Add checks to avoid use of logrus WithFields function in hot paths")

@giorio94 giorio94 added area/operator Impacts the cilium-operator component release-note/misc This PR makes changes that have no direct user impact. labels Oct 29, 2024
@giorio94 giorio94 requested a review from a team as a code owner October 29, 2024 08:38
@giorio94 giorio94 requested a review from pippolo84 October 29, 2024 08:38
@giorio94
Copy link
Member Author

/test

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Oct 29, 2024
@julianwiedmann
Copy link
Member

This needs a rebase already :)

@julianwiedmann julianwiedmann added dont-merge/needs-rebase This PR needs to be rebased because it has merge conflicts. and removed ready-to-merge This PR has passed all tests and received consensus from code owners to merge. labels Oct 30, 2024
Slightly modify the service handler debug statement to skip the
expensive computation of service-related log fields when debug
logs are disabled, as not used at all. In particular, rendering
services and endpoints into the corresponding string representation
is demanding both in terms of CPU time and memory allocations.
Passing the original object as parameter, rather than the stringified
version, allows to delegate this operation to slog, which is then
skipped if debug logs are disabled.

Additionally, let's also rework the warning log to only include the
service name and namespace as parameter for simplicity, as it is
never expected to occur (all temporary errors are retried internally).

Related: 52c06e1 ("Add checks to avoid use of logrus WithFields function in hot paths")
Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
@giorio94 giorio94 removed the dont-merge/needs-rebase This PR needs to be rebased because it has merge conflicts. label Oct 30, 2024
@giorio94
Copy link
Member Author

Re-implemented as #35567 got merged in the meanwhile. @pippolo84 PTAL 🙏

@giorio94 giorio94 requested a review from pippolo84 October 30, 2024 08:27
@giorio94
Copy link
Member Author

/test

Copy link
Member

@pippolo84 pippolo84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Oct 30, 2024
@julianwiedmann julianwiedmann added this pull request to the merge queue Oct 30, 2024
Merged via the queue into cilium:main with commit 60f22ae Oct 30, 2024
66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/operator Impacts the cilium-operator component ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants