get dynamic variable..

This commit is contained in:
Cüneyt Şentürk 2023-02-23 13:32:54 +03:00
parent 614c25002c
commit 3f29c17e43
2 changed files with 14 additions and 2 deletions

View File

@ -106,6 +106,8 @@ class Trackers extends Component
$params = [ $params = [
'release' => version('short'), 'release' => version('short'),
'traces_sample_rate' => static::sentryTracesSampleRate(), 'traces_sample_rate' => static::sentryTracesSampleRate(),
'replays_session_sample_rate' => static::sentryReplaysSessionSampleRate(),
'replays_on_error_sample_rate' => static::sentryReplaysOnErrorSampleRate(),
]; ];
break; break;
} }
@ -129,4 +131,14 @@ class Trackers extends Component
return (float) config('sentry.traces_sample_rate', 1.0); return (float) config('sentry.traces_sample_rate', 1.0);
} }
public static function sentryReplaysSessionSampleRate()
{
return (float) config('sentry.replays_session_sample_rate', 0.1);
}
public static function sentryReplaysOnErrorSampleRate()
{
return (float) config('sentry.replays_on_error_sample_rate', 1.0);
}
} }

View File

@ -22,11 +22,11 @@ export default {
// This sets the sample rate to be 10%. You may want this to be 100% while // This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production // in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1, replaysSessionSampleRate: exception_tracker.params.replays_session_sample_rate,
// If the entire session is not sampled, use the below sample rate to sample // If the entire session is not sampled, use the below sample rate to sample
// sessions when an error occurs. // sessions when an error occurs.
replaysOnErrorSampleRate: 1.0, replaysOnErrorSampleRate: exception_tracker.params.replays_on_error_sample_rate,
}); });
Sentry.setUser({ Sentry.setUser({