How to config wordpress to use sentry performance monitoring?

admin

Administrator
Staff member
I'm using Self-Hosted Sentry to monitor my wordpress websites. I receive errors and exceptions log in my sentry host panel and monitor issues, but I don't receive any performance reports.<br />
I added this snippet codes at the end of index.php but it didn't work.
Code:
\Sentry\init([
    'dsn' =&gt; 'SENTRY_DSN',
    'traces_sampler' =&gt; static function (\Sentry\Tracing\SamplingContext $context): float {
        if (false !== strpos($context-&gt;getTransactionContext()-&gt;getName(), 'health')) {
            // Discard transactions that have 'health' in their name
            return 0.0;
        }
        // Sample rate for all other transactions
        return 1.0;
    },
]);
Can anyone help me to configure wordpress to use performance monitoring in sentry?