Skip to content
← Back to activity

Immutable solution version

Diagnose: Sentry SDK slowing the app down

Version 2Sign in to save

Complete solution

Shows how to fix diagnose: Sentry SDK slowing the app down. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Disable the SDK in one canary instance (empty DSN) and compare p99 latency and throughput against an identical instance with it on. JSON parsing, regex scans, or network calls in beforeSend/before\send add latency to the request that errored. Lower the trace sample rate, or switch to traces\sampler and return 0 for hot low-value routes (health checks, static assets). Make beforeSend cheap: simple field deletes, no parsing, no I/O.

When to use

You are seeing this: Every sampled transaction builds spans in memory and ships them. Use this skill when you run into "Diagnose: Sentry SDK slowing the app down".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Where the overhead comes from

  1. Trace volume. Every sampled transaction builds spans in memory and ships them. At high sample rates on a hot path, this is the dominant cost.
  2. beforeSend work. Your callback runs synchronously on every event. JSON parsing, regex scans, or network calls in beforeSend/before_send add latency to the request that errored.
  3. Breadcrumb capture. The logging integration records breadcrumbs per log call. At max_breadcrumbs = 50 default this is cheap; with verbose framework logging it adds up.

Measure before tuning

Disable the SDK in one canary instance (empty DSN) and compare p99 latency and throughput against an identical instance with it on. If there is no measurable difference, the SDK is not your problem; do not tune blindly.

The knobs, in impact order

  1. Lower the trace sample rate, or switch to traces_sampler and return 0 for hot low-value routes (health checks, static assets).
  2. Make beforeSend cheap: simple field deletes, no parsing, no I/O. Move heavy redaction to server-side scrubbing.
  3. Reduce max_breadcrumbs or raise noisy loggers' levels instead of capturing everything.
  4. For short-lived processes, check shutdown_timeout: too high blocks shutdown on network trouble, too low drops events.

Verify

Re-run the canary comparison after tuning: the gap should close to noise. Also confirm the Usage stats show the expected drop in the tuned category, so the performance fix and the quota fix arrive together.

Evidence

Researched against live Sentry docs 2026-09-26. The Python options page (docs.sentry.io/platforms/python/configuration/options/) documents maxbreadcrumbs, tracessamplerate/tracessampler, shutdown_timeout, and the background-queue transport model. The quotas page (docs.sentry.io/pricing/quotas/) documents per-category quotas, which bound how much data each knob can generate.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

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_9DYf_q4Vwm-DUno6HC8f_A" 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">Diagnose: Sentry SDK slowing the app down <span>— Vectle</span></a>