elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.65k stars 8.23k forks source link

[Infra alerting] Use logger callback to defer heavy stringify operations in logger calls #193850

Open maryam-saeidi opened 1 month ago

maryam-saeidi commented 1 month ago

Summary

In a previous PR, we improved the custom threshold logging by using logger callback and removing unnecessary logging. In this ticket, we would like to do the same for the infra-related rules. (You can find more context in this ticket)

Essentially, for any CPU-intensive processing, we need to use logger callback, here is an example of this change:

State Code
Before logger.trace(Request: ${JSON.stringify({ searches })});
After logger.trace(() => Request: ${JSON.stringify({ searches })});

Here is a list of existing instances in the infra plugin that we need to fix:

Image

elasticmachine commented 1 month ago

Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)