WordPress AutoInstrument: Skip WP Core #1032
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With the current WordPress auto-instrumentation implementation most of the spans in APM traces are filled with WP core functions.
For the most part this is not super useful for the majority of WordPress developers / users because there's not much they can do to change how core works. It's also relatively unlikely performance issues are caused by WP core functions as they are used by all WP users and have over the decades been optimized and looked at closely.
It's much more likely performance issues arise due to the themes or plugins that are installed on a site. So it would be more useful to only expose WordPress theme and plugin callbacks as span by default. These callbacks are how WP developers normally go about modifying and adding functionality. (No "core hacks" has been a core tenet of WP developers for quite a long time now.)
This PR makes it so that we default skip instrumentation of WP core callbacks unless a
WP_DEBUG
constant is set which is the WP convention for turning on more verbose logging: https://wordpress.org/documentation/article/debugging-in-wordpress/