Created
March 30, 2020 14:03
-
-
Save cojennin/2f94ec69e2d17b49753a3c6822762f45 to your computer and use it in GitHub Desktop.
Example client-runrise.php file for filtering New Relic transactions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Only using server var to preg match. | |
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
// phpcs:disable WordPress.VIP.SuperGlobalInputUsage.AccessDetected | |
// phpcs:disable WordPress.VIP.ValidatedSanitizedInput.InputNotSanitized | |
// phpcs:disable WordPress.VIP.ValidatedSanitizedInput.InputNotValidated | |
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotValidated | |
$url = $_SERVER['REQUEST_URI']; | |
// phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
// phpcs:enable WordPress.VIP.SuperGlobalInputUsage.AccessDetected | |
// phpcs:enable WordPress.VIP.ValidatedSanitizedInput.InputNotSanitized | |
// phpcs:enable WordPress.VIP.ValidatedSanitizedInput.InputNotValidated | |
// phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotValidated | |
/** | |
* This will filter out any URL from New Relic that contains `wp-admin` | |
*/ | |
if ( function_exists( 'newrelic_ignore_apdex' ) && preg_match( '/wp-admin/', $url ) ) { | |
newrelic_ignore_apdex(); | |
} | |
if ( function_exists( 'newrelic_ignore_transaction' ) && preg_match( '/wp-admin/', $url ) ) { | |
newrelic_ignore_transaction(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment