A profile records the call stack many times a second while a transaction runs. AppHelm merges those samples into a flame graph: the wider a box, the more time was spent in that function. Use it when a trace tells you a step is slow but not why.
Profiles are tied to tracing. An SDK profiles a transaction only when the transaction is sampled, and then only with the profile rate, which is off by default. The share of transactions profiled is tracesSampleRate × profilesSampleRate. With a traces rate of 0.2 and a profiles rate of 0.5, one transaction in ten is profiled.
Profiles hold function names, file paths and line numbers. They never hold argument values or local variables. They don't count against your event allowance.
#Turn profiling on
Set a traces rate first, then the profiles rate next to it.
No example for this step; showing JavaScript (browser).
// The page's HTML must be served with the header Document-Policy: js-profiling (see below).
window.apphelm = createBrowserSdk({ key: "ahl_pub_…", workspaceId: "org_…", productId: "prd_…",
tracesSampleRate: 0.2, profilesSampleRate: 0.5 });<ApphelmProvider options={{ key: import.meta.env.VITE_APPHELM_KEY, workspaceId: "org_…", productId: "prd_…",
tracesSampleRate: 0.2, profilesSampleRate: 0.5 }}><ApphelmProvider options={{ key: process.env.NEXT_PUBLIC_APPHELM_KEY!, workspaceId: "org_…", productId: "prd_…",
tracesSampleRate: 0.2, profilesSampleRate: 0.5 }}>export const apphelm = createBrowserSdk({ key: import.meta.env.VITE_APPHELM_KEY, workspaceId: "org_…", productId: "prd_…",
tracesSampleRate: 0.2, profilesSampleRate: 0.5 });export const apphelm = createBrowserSdk({ key: import.meta.env.VITE_APPHELM_KEY, workspaceId: "org_…", productId: "prd_…",
tracesSampleRate: 0.2, profilesSampleRate: 0.5 });const apphelm = new Apphelm({ apiKey: process.env.APPHELM_API_KEY!, workspaceId: "org_…", productId: "prd_…",
tracesSampleRate: 0.2, profilesSampleRate: 0.5 });apphelm.init(api_key=os.environ["APPHELM_API_KEY"], workspace_id="org_…", product_id="prd_…",
traces_sample_rate=0.2, profiles_sample_rate=0.5)var options = ApphelmOptions(apiKey: "ahl_live_…", workspaceId: "org_…", productId: "prd_…", tracesSampleRate: 0.2)
options.profilesSampleRate = 0.5
let apphelm = ApphelmClient(options: options)Apphelm.setup(this, ApphelmConfig(BuildConfig.APPHELM_API_KEY, "org_…", "prd_…").apply {
tracesSampleRate = 0.2
profilesSampleRate = 0.5
})val apphelm = ApphelmClient(ApphelmOptions(/* key, workspace, product */, tracesSampleRate = 0.2, profilesSampleRate = 0.5))import { Platform } from "react-native";
import { createReactNativeSdk } from "@sansavision/apphelm/react-native";
import { hermesProfiling } from "@sansavision/apphelm/react-native-profiling";
import { hermesSampler } from "@sansavision/apphelm-react-native-profiler";
export const apphelm = createReactNativeSdk({
apiKey: process.env.EXPO_PUBLIC_APPHELM_KEY!, workspaceId: "org_…", productId: "prd_…",
release: "app@2.3.0+45", tracesSampleRate: 0.2,
profiling: hermesProfiling({ profilesSampleRate: 0.5, sampler: hermesSampler, platform: Platform.OS }),
});client, err := apphelm.New(apphelm.Config{
// …
TracesSampleRate: apphelm.Float(0.2),
ProfilesSampleRate: apphelm.Float(0.5),
})APPHELM = Apphelm::Client.new(api_key: ENV.fetch("APPHELM_API_KEY"), workspace_id: "org_…", product_id: "prd_…",
traces_sample_rate: 0.2, profiles_sample_rate: 0.5)// Needs the ext-excimer extension: pecl install excimer
$apphelm = new Client(apiKey: getenv('APPHELM_API_KEY'), workspaceId: 'org_…', productId: 'prd_…',
tracesSampleRate: 0.2, profilesSampleRate: 0.5);// dotnet add package SansaVision.Apphelm.Profiling
using Apphelm.Profiling;
var options = new ApphelmOptions { ApiKey = key, WorkspaceId = "org_…", ProductId = "prd_…",
TracesSampleRate = 0.2, ProfilesSampleRate = 0.5 };
options.AddProfiling();// Cargo.toml: apphelm = { version = "0.8", registry = "apphelm", features = ["profiling"] }
let apphelm = Client::new(Options::new(key).workspace_id("org_…").product_id("prd_…")
.traces_sample_rate(0.2).profiles_sample_rate(0.5))?;config :apphelm,
traces_sample_rate: 0.2,
profiles_sample_rate: 0.5Flutter has no profiler. Dart can't sample its own isolate's stack, and the VM service's CPU profiler isn't in release builds. Sentry's Flutter SDK dropped profiling for the same reason. Use tracing spans to find slow steps in a Flutter app; native code in the same app can be profiled with the iOS or Android SDK.
Profiling in React Native needs Hermes and the native package @sansavision/apphelm-react-native-profiler (npm install @sansavision/apphelm-react-native-profiler, React Native 0.71 or later). Rebuild the app after installing it. Expo Go can't load it; use a development build.
#What each SDK samples
| SDK | Option | What is sampled | Interval |
|---|---|---|---|
| Browser | profilesSampleRate |
The page's JavaScript, with the JS Self-Profiling API, during page loads only (not navigations) | 10 ms |
| Node | profilesSampleRate |
The JavaScript thread, with V8's CPU profiler (node:inspector); no native add-on |
10 ms |
| Python | profiles_sample_rate |
The thread that started the transaction | 10 ms |
| iOS, macOS | profilesSampleRate |
The main thread, walked by frame pointers | 10 ms |
| Android | profilesSampleRate |
The main (Looper) thread's Java and Kotlin stack | 20 ms |
| JVM | profilesSampleRate |
The thread that started the transaction | 20 ms |
| React Native | hermesProfiling({ profilesSampleRate, sampler }) |
The JavaScript thread, by Hermes's own sampling profiler | about 10 ms |
| Go | ProfilesSampleRate |
The transaction's goroutine and the goroutines it starts | 10 ms |
| Ruby | profiles_sample_rate: |
The thread that started the transaction | 10 ms |
| PHP | profilesSampleRate |
The request, with ext-excimer (wall clock) | 10 ms |
| .NET | ProfilesSampleRate + options.AddProfiling() |
Managed threads, from an in-process EventPipe session | 10 ms per thread |
| Rust | .profiles_sample_rate(…) + feature profiling |
Every thread using CPU (pprof-rs, SIGPROF) |
10 ms of CPU time |
| Elixir | :profiles_sample_rate |
The transaction's own process | 10 ms |
| Flutter | none | Not supported |
Every SDK takes one profile at a time per process (Go: per client); a transaction that starts while another is being profiled is not profiled. A profile stops after 30 seconds or 3,000 samples (Android: 1,500), and one larger than 1 MB is dropped on the device. Profiles don't go through beforeSend.
Platform notes:
- Android: native (NDK) frames are not sampled.
- iOS: frames are addresses. Upload your dSYMs so they get names (see symbols).
- .NET: .NET 8 or later. It doesn't work on NativeAOT, with
DOTNET_EnableDiagnostics=0, or in a single-file app without diagnostics. The first part of a profile isn't sampled while the session starts. - Rust: Linux and macOS. Elsewhere the feature builds but profiles nothing. A waiting thread isn't sampled, because the sampler counts CPU time.
- Ruby: while one thread holds the GVL, samples arrive only at thread switches.
- PHP: without ext-excimer nothing is profiled and nothing fails.
#Browser: the Document-Policy header
Browsers let a page profile itself only when its HTML is served with this response header:
Document-Policy: js-profilingWithout it the SDK does nothing: no profiler starts, nothing is logged, and the page load is sent without a profile. Add it to the response that serves your HTML, not your scripts:
- Cloudflare Pages, Netlify (
_headers): a line/*, then indentedDocument-Policy: js-profiling. - Vercel (
vercel.json):{"headers": [{"source": "/(.*)", "headers": [{"key": "Document-Policy", "value": "js-profiling"}]}]} - Next.js (
next.config.js):async headers() { return [{ source: "/:path*", headers: [{ key: "Document-Policy", value: "js-profiling" }] }]; } - nginx:
add_header Document-Policy "js-profiling"; - Express:
app.use((req, res, next) => { res.setHeader("Document-Policy", "js-profiling"); next(); });
Only Chromium browsers (Chrome, Edge, Opera) have the API, so Safari and Firefox page loads are never profiled. The profile starts once analytics consent exists and the tracing module has loaded, so the very start of a page load may be missing. Chrome notes a small cost for pages served with the header even when no profiler runs, which is why adding it is your choice.
#Source maps and symbols
Release builds profile minified or compiled code. AppHelm turns frames back into your code when the flame graph is shown, so symbols you upload after a profile arrives still apply.
| Platform | How frames get names | What to upload |
|---|---|---|
| Browser, Node, React Native | Source maps: the map with the bundle's debug id, else the release and file path, else the release's only map with that file name. React Native names come from Metro's function map. | The same maps as for errors: apphelm sourcemaps upload, a bundler plugin, or apphelm sourcemaps upload --bundle for React Native |
| iOS, macOS (Swift) | Mach-O symbol tables, giving the function name and, when present, the file and line | dSYMs: npx apphelm debug-files upload build/Shop.app.dSYM |
| Python, Ruby, Go, PHP, Elixir, Kotlin, .NET, Rust | Named by the SDK on the device | Nothing |
Not done today: ELF and Windows (PE) symbols for profiles, inline frames, and ProGuard or R8 deobfuscation of Android profile frames (errors are deobfuscated; profile frames from a minified Android build keep their obfuscated names). Per view, AppHelm maps at most the 2,000 most sampled JavaScript frames, 10 files and 6 maps of up to 8 MB each, and 300 native addresses; the rest are shown as sent. The flame graph names the files that have no map and gives the upload command. See Source maps and debug symbols.
#View profiles
Open Performance, pick a transaction, and choose Profiles:
- Flame graph: the most recent 20 profiles of that transaction in the time range, merged. One box per function and file. Click a box to zoom; Reset zoom goes back. Very small calls are folded into (smaller calls).
- Heaviest functions: the 15 functions with the most samples.
- Recent profiles: open one profile on its own. A Thread picker switches threads; the default is the transaction's thread, else the main thread.
- From a trace: in a trace's waterfall, Show profile opens the profile of that transaction.
A transaction is linked to its profile by the profile_id the SDK puts on it, else by trace and span id, else (for Sentry continuous profiling) by profiler id and time.
#Sentry SDKs
Profiles from Sentry SDKs pointed at an AppHelm DSN are accepted: profile items (sample format v1) and profile_chunk items (continuous profiling, format v2, as sent with profileSessionSampleRate and profileLifecycle: "trace"). Android's legacy ART trace format is not supported. AppHelm refuses it with android_trace_unsupported and asks the SDK to back off for an hour. Migrate from Sentry has the rest.
#Send profiles yourself
The SDKs post profiles for you. If you write your own profiler, post Sentry's sample format (v1) JSON:
No example for this step; showing HTTP (curl).
curl -X POST https://apphelm.dev/api/v1/profiles \
-H "Authorization: Bearer $APPHELM_API_KEY" \
-H "Content-Type: application/json" \
--data @profile-request.json # { "productId": "prd_…", "profile": { …Sentry sample format v1… } }
# 202 { "accepted": true, "id": "…" }- Key: a server key with
events:write.productIdmay be left out when the key covers one product. - Format: Sentry sample format v1 or v2 JSON. Chrome
.cpuprofilefiles and raw JS Self-Profiling traces are not accepted; the SDKs convert those on the device. - Size: 1 MB per request as sent, gzip accepted (4 MB unzipped), and 1 MB once stored.
#Limits and retention
| Limit | Value |
|---|---|
| Profiles per product per UTC day | 10,000 |
| Stored profile bytes per product per UTC day | 500 MB (compressed) |
| Frames, stacks and samples in one profile | 5,000 frames, 10,000 stacks, 30,000 samples, 256 frames deep (innermost kept), 64 threads |
| Profile duration accepted | 10 minutes (SDKs stop at 30 s) |
| Kept for | your plan's capture retention: 14 days (Free), 30 (Builder), 90 (Portfolio), 365 (Scale) |
Past the daily cap the API answers 429 profile_limit with Retry-After set to UTC midnight, and Sentry SDKs are told to pause profiles. Anything cut to fit a limit is marked as truncated in the profile.
#Overhead
- Browser: the browser's own sampler at 10 ms. The profiling code is a lazy module that loads only for profiled page loads.
- Node: V8's sampler, typically a few percent of CPU while a profile runs and nothing otherwise.
- Python: a daemon thread wakes every 10 ms and holds the GIL briefly; under CPU-bound load expect 60 to 100 samples a second.
- iOS: each sample suspends the main thread for a few tens of microseconds, about 0.3% of the main thread.
- Android: each sample suspends the main thread at a safepoint, on the order of 1% of the main thread.
- .NET: the runtime's sample profiler runs while a session is open; nothing runs between profiles.
- React Native: not yet measured on a device.
Keep profilesSampleRate modest in production (0.1 to 0.5 of traced transactions) and raise it while you investigate.
#Troubleshooting
| Symptom | Likely cause | What to do |
|---|---|---|
| No profiles at all | No traces rate, or profilesSampleRate not set |
Set both; profiles come only from sampled transactions |
| Browser page loads have no profile | The HTML lacks Document-Policy: js-profiling, or the browser isn't Chromium |
Add the header to the HTML response; test in Chrome |
| Browser navigations have no profile | Only page loads are profiled in the browser | Use spans to time navigations |
| Frames show minified names or addresses | No source map or dSYM was uploaded for that release | Upload maps with apphelm sourcemaps upload, dSYMs with apphelm debug-files upload; the flame graph updates without resending profiles |
| Android profile frames are obfuscated | Profiles are not deobfuscated with ProGuard/R8 mappings | Profile a build without minification, or read names from errors, which are deobfuscated |
| Concurrent requests are not all profiled | One profile at a time per process | Expected; over many requests the sample is still representative |
| PHP sends no profiles | ext-excimer isn't installed | pecl install excimer and enable it |
| .NET sends no profiles | AddProfiling() wasn't called, or the app is NativeAOT or has diagnostics off |
Add the Profiling package and call options.AddProfiling(); run on the regular runtime |
| Rust sends no profiles | The profiling feature is off, or the platform is not Linux or macOS |
Enable the feature with version 0.8 or later |
Sentry Android profiles are refused (android_trace_unsupported) |
The legacy ART trace format | Use the AppHelm Android SDK for profiles |
429 profile_limit |
The product's daily profile cap is reached | Lower profilesSampleRate; the cap resets at UTC midnight |