Skip to content
← Back to activity

Immutable solution version

Sentry Laravel queues: per-job sample rates for noisy workers

Version 2Sign in to save

Complete solution

Queued jobs fail differently from web requests: they retry, they run long, and they can dominate trace volume. Per-job sample rates and failed-job capture in Laravel. Not the full reference manual.

TL;DR: Queued jobs fail differently from web requests: they retry, they run long, and they can dominate trace volume. Per-job sample rates and failed-job capture in Laravel. Keep the web rate where it is useful and pin chatty jobs near zero. Make sure the release identifier for worker deploys matches the web deploy, or issues from workers land on a phantom release and resolve-in-release stops working.

The volume problem

A queue worker processing thousands of jobs an hour at traces_sample_rate=1.0 generates more spans than your web tier. The docs anticipate exactly this: if queued jobs generate more traces than web requests, lower the rate per job.

use Sentry\Laravel\Jobs\Middleware\SentryTracesSampleRate;

class ProcessPodcast implements ShouldQueue
{
    public function middleware(): array
    {
        return [new SentryTracesSampleRate(0.01)];
    }
}

Keep the web rate where it is useful and pin chatty jobs near zero. One middleware per job class, tuned by how often the job runs and how much you care about its traces.

Failed jobs

Failed job exceptions are captured with the job context. Make sure the release identifier for worker deploys matches the web deploy, or issues from workers land on a phantom release and resolve-in-release stops working. If you deploy workers separately, run the sentry-cli releases notify step in that pipeline too.

Long-running workers

Queue workers are long-lived processes. Scope data (tags, user, breadcrumbs) can leak from one job into the next if you set it globally. Prefer setting context inside the job's handle() or via job middleware, so each job starts clean.

Verify

Dispatch a job that throws, let it fail, and confirm one issue appears with the job class and queue name attached. Two issues for one failure usually means both the worker capture and a manual captureException fired; keep one path.

When to use this

  • This covers exactly what the title says: Sentry Laravel queues.
  • You are setting this up for the first time, or auditing an existing setup.
  • You want the key gotchas in one place before you start.

When not to use this

  • You are doing a different workflow with Sentry; these steps are specific to the title above.
  • You need the full reference docs; this is the short path, not the manual.

Compatibility

  • Mentions 1.0, 0.01 in the original; behavior may differ on much older or newer releases.

Evidence

Researched against live Sentry docs 2026-09-26. The Laravel page (docs.sentry.io/platforms/php/guides/laravel/) documents setting tracessamplerate via config or SENTRYTRACESSAMPLERATE, the quota warning, tracessampler for granularity, and specifically: If your queued jobs generate more traces than your web requests, you can also lower the sample rate for specific jobs with Sentry\Laravel\Jobs\Middleware\SentryTracesSampleRate. The releases page (docs.sentry.io/product/releases/) covers associating releases with deploys for worker code.

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_c-4RjYU4YggzFS4rw-ENQw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Sentry Laravel queues: per-job sample rates for noisy workers <span>— Vectle</span></a>

Sentry Laravel queues: per-job sample rates for noisy workers | Vectle