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

Disabling xhr autobreadcrumbs not available anymore in 1.0.0-beta.5 #639

Closed
3 of 5 tasks
ppeszko opened this issue Aug 20, 2019 · 1 comment
Closed
3 of 5 tasks

Comments

@ppeszko
Copy link

ppeszko commented Aug 20, 2019

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

Output of node -v && npm -v && npm ls --prod --depth=0

v11.9.0
6.5.0
app@0.0.1 /Users/app
├── @react-native-community/async-storage@1.6.1
├── @react-native-community/geolocation@1.4.2
├── @sentry/react-native@1.0.0-beta.5
├── @turf/turf@5.1.6
├── airbrake-js@2.0.0-rnbeta.2 invalid
├── lodash@4.17.15
├── lottie-ios@3.0.3
├── lottie-react-native@3.0.4
├── memoize-one@5.0.5
├── moment@2.24.0
├── portable-fetch@3.0.0
├── pure-uuid@1.5.7
├── react@16.8.6
├── UNMET PEER DEPENDENCY react-native@0.60.4
├── react-native-action-sheet@2.0.1 invalid
├── react-native-blur@3.2.2
├── react-native-config@0.11.7
├── react-native-cookies@3.3.0
├── react-native-device-info@2.3.2
├── react-native-fast-image@7.0.2
├── react-native-firebase@5.5.6
├── react-native-gesture-handler@1.3.0
├── react-native-image-crop-picker@0.25.0 invalid
├── react-native-inappbrowser-reborn@3.0.0 invalid
├── react-native-keyboard-aware-scroll-view@0.8.0
├── react-native-linear-gradient@2.5.6
├── react-native-markdown-renderer@3.1.0
├── react-native-paper@2.16.0
├── react-native-reanimated@1.2.0
├── react-native-safari-view@2.1.0
├── react-native-splash-screen@3.2.0
├── react-native-thumbnail@1.1.3
├── react-native-vector-icons@6.6.0
├── react-native-webview@6.9.0
├── react-navigation@3.11.1
├── react-redux@7.1.0
├── redux@4.0.4
├── redux-observable@1.1.0
├── redux-thunk@2.3.0
├── rxjs@6.5.2
└── typesafe-actions@4.4.2

Config:

Sentry.init({
      defaultIntegrations: [
        new ReactNativeErrorHandlers(),
        new Release(),
        ...defaultIntegrations.filter(
          i => !IGNORED_DEFAULT_INTEGRATIONS.includes(i.name),
        ),
        new Integrations.Breadcrumbs({
          console: false, // If this in enabled it causes problems to native calls on >= RN 0.60
          fetch: false,
          xhr: false, // This is the only change to the sentry original code, here we turn off automatic xhr tracking
        }),
        new DebugSymbolicator(),
        new RewriteFrames({
          iteratee: (frame: StackFrame) => {
            if (frame.filename) {
              frame.filename = frame.filename
                .replace(/^file\:\/\//, '')
                .replace(/^address at /, '')
                .replace(/^.*\/[^\.]+(\.app|CodePush|.*(?=\/))/, '');

              const appPrefix = 'app://';
              // We always want to have a triple slash
              frame.filename =
                frame.filename.indexOf('/') === 0
                  ? `${appPrefix}${frame.filename}`
                  : `${appPrefix}/${frame.filename}`;
            }
            return frame;
          },
        }),
        new DeviceContext(),
      ],
      dsn: SENTRY_DNS,
    });

I have following issue:

I would like to be able to disable automatic breadcrumbs/tracking of the http requests.
In the older Sentry, let say 0.39.0, there was an option autoBreadcrumbs: false. This setting is not available any more. The only way I found to get similar results is to copy&paste almost the whole content of sdk.ts https://github.com/getsentry/sentry-react-native/blob/master/src/js/sdk.ts#L28, just to add one line xhr: false in line 44 :/

It would be great to be able to provide my own settings without overwriting ALL of your default settings. Right now it is: take all settings without a change or provide everything not matter you want to change them or not.

@HazAT
Copy link
Member

HazAT commented Sep 4, 2019

I just released 1.0.3 exposing BrowserIntegrations that should make this more easy.
You can just do

Sentry.init({
  ...
  integrations: [
    new Sentry.BrowserIntegrations.Breadcrumbs({
      console: false, // If this in enabled it causes problems to native calls on >= RN 0.60
      fetch: false,
      xhr: false
    })
  ]
});

hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants