Added JavaScript Profiling with Sentry

This commit is contained in:
Ahmad 2024-12-21 17:38:50 -05:00
parent d03340dd5a
commit a3c568d5a1
No known key found for this signature in database
GPG key ID: 8FD8A93530D182BF
2 changed files with 26 additions and 2 deletions

View file

@ -23,6 +23,19 @@ const nextConfig: NextConfig = {
}, },
], ],
}, },
async headers() {
return [
{
source: '/:path*',
headers: [
{
key: 'Document-Policy',
value: 'js-profiling',
},
],
},
];
},
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'], pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
compress: true, compress: true,
serverMiddleware: [compression()], serverMiddleware: [compression()],

View file

@ -19,8 +19,19 @@ Sentry.init({
}), }),
], ],
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. // Set tracesSampleRate to 1.0 to capture 100%
tracesSampleRate: 1, // of transactions for tracing.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
// Set `tracePropagationTargets` to control for which URLs trace propagation should be enabled
tracePropagationTargets: ['localhost', /^https:\/\/tasko\.ahmadk953\.org/],
// Set profilesSampleRate to 1.0 to profile every transaction.
// Since profilesSampleRate is relative to tracesSampleRate,
// the final profiling rate can be computed as tracesSampleRate * profilesSampleRate
// For example, a tracesSampleRate of 0.5 and profilesSampleRate of 0.5 would
// result in 25% of transactions being profiled (0.5*0.5=0.25)
profilesSampleRate: 1.0,
// Define how likely Replay events are sampled. // Define how likely Replay events are sampled.
replaysSessionSampleRate: 0.5, replaysSessionSampleRate: 0.5,