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

Release 10.16 #815

Merged
merged 9 commits into from
Jan 19, 2024
Merged

Release 10.16 #815

merged 9 commits into from
Jan 19, 2024

Conversation

mfulb
Copy link
Contributor

@mfulb mfulb commented Jan 19, 2024

No description provided.

bduranleau-nr and others added 9 commits December 20, 2023 14:35
Change user-facing documentation links to use `https` instead of `http`
In PHPs 7.4+ use add_filter wrapper to wrap wordpress hooks callbacks.
Older PHPs still use call_user_function_array callback. This approach
limits the number of times the agent is called by Zend Engine during
WordPress transaction execution because add_filter (and add_action,
which is just a wrapper around add_filter) is called less frequently
(called when filter is added to a hook) than call_user_function_array
(called each time hook executes). The number of times the agent is
called by Zend Engine translates to the number of times a wraprec for
user function is looked up, and since the agent changed the method how
it stores wraprecs in PHPs 7.4+ it is an important optimization.

---------

Co-authored-by: Michal Nowacki <[email protected]>
Co-authored-by: bduranleau-nr <[email protected]>
`nr_php_wrap_generic_callable` is used to create transient wraprecs for
callables which **_don't require to be named_**. This assumption makes
it possible to stay DRY and reuse `nr_php_zval_to_function` in lieu of
complex pattern matching for the type of callable. This reduces agent's
performance overhead as it now uses `nr_php_wrap_callable` always
instead of using `nr_php_wrap_user_function_with_transience(IS_TRANSIENT)`
sometimes.

TL:DR; The agent's performance overhead when
`nr_php_wrap_user_function_with_transience(IS_TRANSIENT)` is used comes
from the need to walk the linked list of named wraprecs in
`nr_php_add_custom_tracer_named`.
Improve agent's performance by figuring out the plugin/theme name at the
point an action or filter is added and store it in the wraprec rather
than doing it at runtime (which is slow, even with memoization in
`wordpress_file_metadata` hashmap).
Improve agent's performance by adding two new toggles around WordPress
instrumentation:
- `newrelic.framework.wordpress.plugins` - indicates if WordPress hooks
callback functions, implemented in WordPress core, plugins and themes,
are to be instrumented.
- `newrelic.framework.wordpress.hooks_threshold` - sets the WordPress
hook's execution duration threshold above which the hook execution will
be captured; used when WordPress hooks callback functions are not
instrumented.

By default, WordPress hooks callback functions are not instrumented and
`newrelic.framework.wordpress.hooks_threshold` is set at 1ms. This
allows to identify which hooks take up most time during request
processing. If more details are needed, i.e. which plugins are the
slowest, `newrelic.framework.wordpress.plugins` need to be set to
`true`.
Improve agent's performance by adding a new toggle around WordPress
instrumentation:

* `newrelic.framework.wordpress.core` - indicates if WordPress hooks
callback functions, implemented in WordPress core, are to be
instrumented.

By default WordPress hook callbacks from WordPress core are not
instrumented because it increases agent's overhead. It is however
possible to enable this instrumentation with INI setting.
Hide boolean flags controling wordpress hooks instrumentation behind
a `newrelic.framework.wordpress.hooks.options` facade. The facade makes
invalid combinations of boolean flags impossible to set. Additionally
do not surprise users with a change to agent behavior. Set the new toggles
to values that maintain behavior. This allows for transition period when
users can understand the new feature and be prepared for the change.
@codecov-commenter
Copy link

codecov-commenter commented Jan 19, 2024

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (6c27106) 78.47% compared to head (de48e8f) 78.74%.

Files Patch % Lines
agent/fw_wordpress.c 83.33% 7 Missing ⚠️
agent/php_wrapper.c 57.14% 3 Missing ⚠️
agent/php_execute.c 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #815      +/-   ##
==========================================
+ Coverage   78.47%   78.74%   +0.27%     
==========================================
  Files         189      189              
  Lines       26335    26370      +35     
==========================================
+ Hits        20666    20766     +100     
+ Misses       5669     5604      -65     
Flag Coverage Δ
agent-for-php-7.0 77.60% <83.33%> (+0.38%) ⬆️
agent-for-php-7.1 77.33% <83.33%> (+0.39%) ⬆️
agent-for-php-7.2 77.89% <83.33%> (+0.39%) ⬆️
agent-for-php-7.3 77.91% <81.25%> (+0.39%) ⬆️
agent-for-php-7.4 77.58% <83.33%> (+0.26%) ⬆️
agent-for-php-8.0 77.67% <83.33%> (+0.26%) ⬆️
agent-for-php-8.1 77.63% <83.33%> (+0.26%) ⬆️
agent-for-php-8.2 77.41% <83.33%> (+0.26%) ⬆️
agent-for-php-8.3 77.41% <83.33%> (+0.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mfulb mfulb merged commit 320ea57 into main Jan 19, 2024
117 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants