SentryTracesSampleRate
class SentryTracesSampleRate
Job middleware that overrides the Sentry trace sampling decision for the job's transaction.
When applied to a job, this middleware re-samples the transaction at the given rate, allowing you to control trace volume for specific jobs independently of the global sample rate.
If the transaction was not sampled by the global traces_sample_rate or traces_sampler,
this middleware will not force-enable it — it can only downsample, not upsample.
Usage:
public function middleware(): array
{
return [
new SentryTracesSampleRate(0.1), // Sample 10% of this job's traces
];
} Methods
__construct(float $sampleRate)
Create a new middleware instance.
Details
at line 35
__construct(float $sampleRate)
Create a new middleware instance.
at line 46
void
handle(object $job, Closure $next)
Handle the queued job.