Missing profiles even though the profileSampleRate is set to 1
Platform:
- [x] iOS
- [x] Android
SDK version: 5.22.1
react-native version: 0.71.13
Are you using Expo?
- [ ] Yes
- [x] No
Are you using sentry.io or on-premise?
- [x] sentry.io (SaaS)
- [ ] on-premise
If you are using sentry.io, please post a link to your issue so we can take a look:
See linked Jira
Configuration:
see comment below
I have the following issue:
A significant number of transactions do not have profiles attached, even though the profileSampleRate is set to 1.
No correlation with release, os, transaction.op/status, or sdk.version (see Jira ticket for Discover queries for each of those)
stats_v2 are clean - all profiles accepted, nothing dropped or discarded on client side.
┆Issue is synchronized with this Jira Improvement by Unito
Here's the Sentry initialization configuration:
Native initialization:
Android:
AndroidManifest.xml:
<provider
android:name="io.sentry.android.core.SentryInitProvider"
android:authorities="${applicationId}.SentryInitProvider"
tools:node="remove" />
<provider
android:authorities="${applicationId}.SentryPerformanceProvider"
android:name="io.sentry.android.core.SentryPerformanceProvider"
tools:node="remove" />
MainApplication.java
SentryAndroid.init(this, options -> {
options.setDsn(dsn);
options.setDebug(false);
options.setBeforeSend(((event, hint) -> {
try {
SentryException exception = event.getExceptions().get(0);
if (null != exception && exception.getType().contains("JavascriptException")) {
return null;
}
} catch (Throwable ignored) {
}
return event;
}));
options.setTracesSampleRate(1.0);
});
iOS:
AppDelegate
[SentrySDK startWithConfigureOptions:^(SentryOptions * _Nonnull options) {
options.dsn = dsn;
options.debug = false;
options.enableCaptureFailedRequests = NO;
options.tracesSampler = ^NSNumber * (SentrySamplingContext * samplingContext) {
return @0;
};
options.beforeSend = ^SentryEvent * _Nullable(SentryEvent * _Nonnull event) {
if (event.exceptions.firstObject.type && [event.exceptions.firstObject.type rangeOfString:@"Unhandled JS Exception"].location != NSNotFound) {
return nil;
}
return event;
};
}];
JS Initialization
Sentry.init({
dsn,
autoInitializeNativeSdk: false,
debug: false,
enabled: true,
attachViewHierarchy: false,
attachScreenshot: false,
enableCaptureFailedRequests: false,
beforeBreadcrumb: breadcrumb => {
if (['xhr', 'fetch', 'console', 'Logcat'].includes(breadcrumb.category)) {
return null;
}
return breadcrumb;
},
tracesSampler: samplingContext => {
return 1;
},
enableAutoPerformanceTracing: true,
integrations: defaultIntegrations => {
const filteredIntegrations = defaultIntegrations.filter(integration => {
return integration.name !== 'DebugSymbolicator';
});
filteredIntegrations.push(new Sentry.ReactNativeTracing({
enableNativeFramesTracking: true,
enableStallTracking: true,
enableHTTPTimings: true,
traceFetch: true,
traceXHR: true
}));
return filteredIntegrations;
},
tracePropagationTargets: [],
ignoreErrors: [],
ignoreTransactions: [],
_experiments: {
profilesSampleRate: 1
}
});
Thank you @realkosty and @quantumCoder174 for the details.
The init options look correct.
I've explored some of the examples @realkosty shared in the Jira issue.
And I've noticed that most of the transactions which are missing profiles are missing the HermesProfiling integration which would indicate profilesSampleRate not being set.
I've notices a small number (2-4) of transactions which had HermesProfiling Integration and were missing profiles. These transaction were unusually long (1-2 minutes). The finished profiles (max duration 30 seconds) are saved to FIFO cache with size 20. Depending on your application and the number of transactions and profiles, this cache could overflow.
Do you have any specific release that we should focus on (not to reveal any private information feel free to share this in private with @realkosty)? Are you able to reproduce the situation with missing profiles?
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀