Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing profiles even though the profileSampleRate is set to 1 #3816

Open
4 of 6 tasks
realkosty opened this issue May 13, 2024 · 3 comments
Open
4 of 6 tasks

Missing profiles even though the profileSampleRate is set to 1 #3816

realkosty opened this issue May 13, 2024 · 3 comments
Labels

Comments

@realkosty
Copy link

realkosty commented May 13, 2024

Platform:

  • iOS
  • Android

SDK version: 5.22.1

react-native version: 0.71.13

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

  • 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

@realkosty realkosty added the Sync: Jira apply to auto-create a Jira shadow ticket label May 13, 2024
@quantumCoder174
Copy link

quantumCoder174 commented May 14, 2024

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
  }
});

@krystofwoldrich
Copy link
Member

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?

@getsantry
Copy link

getsantry bot commented Jun 6, 2024

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 🥀

@getsantry getsantry bot added the Stale label Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Waiting for: Community
Status: Needs More Information
Development

No branches or pull requests

3 participants