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(agent): update default for wp hooks options #880

Merged
merged 3 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent/php_nrini.c
Original file line number Diff line number Diff line change
Expand Up @@ -1896,7 +1896,7 @@ static PHP_INI_MH(nr_custom_events_max_samples_stored_mh) {
return SUCCESS;
}

#define DEFAULT_WORDPRESS_HOOKS_OPTIONS "all_callbacks"
#define DEFAULT_WORDPRESS_HOOKS_OPTIONS "plugin_callbacks"
static PHP_INI_MH(nr_wordpress_hooks_options_mh) {
nrinistr_t* p;

Expand Down
14 changes: 7 additions & 7 deletions agent/scripts/newrelic.ini.template
Original file line number Diff line number Diff line change
Expand Up @@ -1169,17 +1169,17 @@ newrelic.daemon.logfile = "/var/log/newrelic/newrelic-daemon.log"
; Setting: newrelic.framework.wordpress.hooks.options
; Type : string (all_callbacks, plugin_callbacks, threshold)
; Scope : per-directory
; Default: all_callbacks
; Default: plugin_callbacks
; Info : Sets the options how WordPress hooks are instrumented.
;
; New Relic agent can provide different levels of insights into WordPress hooks.
; By default, all hook callbacks functions are instrumented ("all_callbacks").
; To reduce agent's overhead it is possible to limit the instrumentation to only
; plugin/theme callbacks ("plugin_callbacks"). Third option is to monitor hooks
; without instrumenting callbacks ("threshold"). This option does not give insights
; about plugins/themes.
; By default, only plugin/theme callbacks are instrumented ("plugin_callbacks").
; At the cost of increased agent's overhead it is possible to extend the
; instrumentation to all hook callbacks functions ("all_callbacks")nly. Third option
lavarou marked this conversation as resolved.
Show resolved Hide resolved
; is to monitor hooks without instrumenting callbacks ("threshold"). This option
; does not give insights about plugins/themes.
;
;newrelic.framework.wordpress.hooks.options = "all_callbacks"
;newrelic.framework.wordpress.hooks.options = "plugin_callbacks"

; Setting: newrelic.framework.wordpress.hooks.threshold
; Type : time specification string ("500ms", "1s750ms" etc)
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/frameworks/wordpress/test_wordpress_00.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
- detect WordPress framework
- name the web transaction as an 'Action' named after the template used to generate the page
- detect custom plugins and themes
- generate hooks metrics for all callback functions executions; the execution time of callback
functions from wordpress core, custom plugins and themes is captured.
- generate hooks metrics only for plugins and themes callback functions executions;
only the execution time of callback functions from custom plugins and themes is captured.
No errors should be generated.
*/

Expand Down Expand Up @@ -40,11 +40,11 @@ functions from wordpress core, custom plugins and themes is captured.
Framework/WordPress/Plugin/mock-plugin2
Framework/WordPress/Plugin/mock-theme1
Framework/WordPress/Plugin/mock-theme2
Framework/WordPress/Hook/wp_init
Framework/WordPress/Hook/the_content
*/

/*EXPECT_METRICS_DONT_EXIST
Framework/WordPress/Hook/wp_init
Framework/WordPress/Hook/the_content
*/

/*EXPECT_ERROR_EVENTS null */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
- detect WordPress framework
- name the web transaction as an 'Action' named after the template used to generate the page
- detect custom plugins and themes
- generate hooks metrics for all callback functions executions; the execution time of callback
functions from wordpress core, custom plugins and themes is captured.
- generate hooks metrics only for plugins and themes callback functions executions;
only the execution time of callback functions from custom plugins and themes is captured.
No errors should be generated.
*/

Expand All @@ -32,11 +32,11 @@ functions from wordpress core, custom plugins and themes is captured.
Framework/WordPress/Plugin/mock-plugin2
Framework/WordPress/Plugin/mock-theme1
Framework/WordPress/Plugin/mock-theme2
Framework/WordPress/Hook/wp_init
Framework/WordPress/Hook/the_content
*/

/*EXPECT_METRICS_DONT_EXIST
Framework/WordPress/Hook/wp_init
Framework/WordPress/Hook/the_content
*/

/*EXPECT_ERROR_EVENTS null */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
- detect WordPress framework
- name the web transaction as an 'Action' named after the template used to generate the page
- detect custom plugins and themes
- generate hooks metrics for all callback functions executions; the execution time of callback
functions from wordpress core, custom plugins and themes is captured.
- generate hooks metrics only for plugins and themes callback functions executions;
only the execution time of callback functions from custom plugins and themes is captured.
No errors should be generated.
*/

Expand All @@ -34,11 +34,11 @@ functions from wordpress core, custom plugins and themes is captured.
Framework/WordPress/Plugin/mock-plugin2
Framework/WordPress/Plugin/mock-theme1
Framework/WordPress/Plugin/mock-theme2
Framework/WordPress/Hook/wp_init
Framework/WordPress/Hook/the_content
*/

/*EXPECT_METRICS_DONT_EXIST
Framework/WordPress/Hook/wp_init
Framework/WordPress/Hook/the_content
*/

/*EXPECT_ERROR_EVENTS null */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
- detect WordPress framework
- name the web transaction as an 'Action' named after the template used to generate the page
- detect custom plugins and themes
- generate hooks metrics for all callback functions executions; the execution time of callback
functions from wordpress core, custom plugins and themes is captured.
- generate hooks metrics only for plugins and themes callback functions executions;
only the execution time of callback functions from custom plugins and themes is captured.
No errors should be generated.
*/

Expand All @@ -34,11 +34,11 @@ functions from wordpress core, custom plugins and themes is captured.
Framework/WordPress/Plugin/mock-plugin2
Framework/WordPress/Plugin/mock-theme1
Framework/WordPress/Plugin/mock-theme2
Framework/WordPress/Hook/wp_init
Framework/WordPress/Hook/the_content
*/

/*EXPECT_METRICS_DONT_EXIST
Framework/WordPress/Hook/wp_init
Framework/WordPress/Hook/the_content
*/

/*EXPECT_ERROR_EVENTS null */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
The agent should properly instrument Wordpress apply_filters hooks. Since the
mocked hooks are detected by the agent as WordPress core (plugin_from_function
returns NULL), and WordPress core callbacks are not instrumented by default,
therefore newrelic.framework.wordpress.core needs to be set to true for the
agent to generate the hooks metrics.
therefore newrelic.framework.wordpress.hooks.options needs to be set to
"all_callbacks" for the agent to generate the hooks metrics.
*/

/*SKIPIF
Expand All @@ -18,7 +18,7 @@
/*INI
newrelic.framework = wordpress
newrelic.framework.wordpress.hooks_threshold = 0
newrelic.framework.wordpress.core = true
newrelic.framework.wordpress.hooks.options = all_callbacks
*/

/*EXPECT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@
The agent should properly instrument Wordpress do_action hooks. Since the
mocked hooks are detected by the agent as WordPress core (plugin_from_function
returns NULL), and WordPress core callbacks are not instrumented by default,
therefore newrelic.framework.wordpress.core needs to be set to true for the
agent to generate the hooks metrics.
therefore newrelic.framework.wordpress.hooks.options needs to be set to
"all_callbacks" for the agent to generate the hooks metrics.
*/

/*SKIPIF
*/

/*INI
newrelic.framework = wordpress
newrelic.framework.wordpress.hooks_threshold = 0
newrelic.framework.wordpress.core = true
newrelic.framework.wordpress.hooks.options = all_callbacks
*/

/*EXPECT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@
metric should be generated and the hook function should be instrumented.
However, since the mocked hooks are detected by the agent as WordPress core
(plugin_from_function returns NULL), and WordPress core callbacks are not
instrumented by default, therefore newrelic.framework.wordpress.core needs
to be set to true for the agent to generate the hooks metrics.
instrumented by default, therefore therefore newrelic.framework.wordpress.hooks.options
needs to be set to "all_callbacks" for the agent to generate the hooks metrics.
*/

/*SKIPIF*/

/*INI
newrelic.framework = wordpress
newrelic.framework.wordpress.hooks = true
newrelic.framework.wordpress.hooks_threshold = 0
newrelic.framework.wordpress.core = true
newrelic.framework.wordpress.hooks.options = all_callbacks
*/

/*ENVIRONMENT
Expand Down
Loading