Profiler
Profiler
The Profiler shows where your code spends its CPU time. It reads the profiles your Sentry SDK sends (Python, Ruby and Node.js are tested), or a pprof file from Go and Rust, and turns them into a flame graph, a list of the hottest functions, and a comparison between two releases. It is part of the LongNeck and Zilla plans; on Leaf your SDK is told to pause profiling and everything else (errors, logs, traces) is unaffected.
Turn it on in your SDK#
Profiling needs tracing: a profile belongs to a traced request, so set a traces sample rate too. Start at a low profile rate in production.
Python. With sentry-sdk 3 (the current release) profiling is continuous, tied to your traces:
sentry_sdk.init(
dsn="https://<public-key>@www.bugzor.com/<project-id>",
traces_sample_rate=1.0,
profile_session_sample_rate=1.0, # a fraction of the sessions
profile_lifecycle="trace", # profile while a traced request runs
)With sentry-sdk 2.x use profiles_sample_rate=1.0 (a fraction of the traced requests) instead of the last two lines.
Ruby (sentry-ruby, with the stackprof gem; vernier also works on Ruby 3.2.1 or newer):
require "stackprof" # before Sentry.init
Sentry.init do |config|
config.dsn = "https://<public-key>@www.bugzor.com/<project-id>"
config.traces_sample_rate = 1.0
config.profiles_sample_rate = 1.0
# config.profiler_class = Sentry::Vernier::Profiler # with the vernier gem instead of stackprof
endNode.js (@sentry/node with @sentry/profiling-node):
import * as Sentry from "@sentry/node";
import { nodeProfilingIntegration } from "@sentry/profiling-node";
Sentry.init({
dsn: "https://<public-key>@www.bugzor.com/<project-id>",
integrations: [nodeProfilingIntegration()],
tracesSampleRate: 1.0,
profileSessionSampleRate: 1.0,
profileLifecycle: "trace", // one profile chunk per request
});Sentry’s PHP and Java SDKs send the same kind of profile; we have not tested them against Bugzor yet. Go and Rust have no Sentry profiling: upload a pprof profile instead, see Profiling Go and Rust.
What you get#
- Profiler page. Pick a project, environment, release or transaction and a time range: the hottest functions (time in the function itself, and including what it calls), and a flame graph you can click into. Download the stacks in the collapsed format other flame graph tools read.
- Your code, not the SDK’s. The Sentry SDK runs its own threads (its profiler’s sampler, a monitor, background workers). Their samples are hidden by default, with a note
saying how many and a link to show them; in a small app they can otherwise be most of what a profile contains. Add
sdk=1to a Profiler URL, orinclude_sdkto an MCP tool, to count them. - One profile. Open any profile for the exact request or chunk, per thread.
- From a slow trace to the code. A trace that has a profile links to it, with the samples of that request.
- Filter by transaction. Pick a route or job name to see only its samples, for per-request profiles and, for continuous profiling, by matching samples to the request that was running on that thread (the last 24 hours).
- Compare two releases. See which functions got hotter or cooler. A function is only listed when the change is large and backed by enough samples (at least 200 samples on each side); otherwise the page says there is not enough data instead of guessing.
- From an issue or a release. Issues and releases link to the profile of the request that failed or to the release’s profile comparison.
- For AI agents. The MCP server has six profiler tools, see AI agents (MCP).
What it keeps, and for how long#
Raw samples (minute-level detail, per-request profiles) are kept for a few days; hourly summaries, which long-window flame graphs and comparisons read, are kept longer. The storage your plan allows covers all profiles together, and is separate from the Rich Trace Logs storage. When it is full, new profiles are refused (your SDK pauses profiling and the page says so) until old samples expire or you change plan. Errors, logs and traces keep flowing.
| Plan | Profiler | Raw samples kept | Hourly summaries kept | Profile storage |
|---|---|---|---|---|
| Leaf | Not included | - | - | - |
| LongNeck | Included | 3 days | 30 days | 5 GB |
| Zilla | Included | 7 days | 90 days | 20 GB |
The meter is in Settings → Billing & usage: it turns amber at 80 % and red when the storage is full.
Good to know#
- Profiles are statistical samples: a function that runs for a few milliseconds will not show up. Comparisons need enough samples to say anything.
- If your app is idle between requests, the SDK sends few samples. A very short-lived process may exit before its last profile chunk is sent (the SDK drops it when its send queue is behind); give it a moment to flush on shutdown.
- A profile may be at most 8 MiB. Profiles from the first requests after a deploy (code loading) are the largest.
Something unclear or out of date? Tell us.