sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

React Native Sentry FullStory Integration

Open TannerLessen opened this issue 3 years ago • 9 comments

Any plans to support a React Native FullStory integration akin to https://github.com/getsentry/sentry-fullstory ?

TannerLessen avatar Dec 15 '21 03:12 TannerLessen

Nothing on the roadmap. But we'll keep this feature request open here and track demand by watching 👍 on the issue

bruno-garcia avatar Dec 15 '21 03:12 bruno-garcia

Appreciate the quick response!

TannerLessen avatar Dec 15 '21 03:12 TannerLessen

@andaydev I'd rather move this question to https://github.com/getsentry/sentry-fullstory since I don't know how the integration works.

marandaneto avatar Feb 04 '22 12:02 marandaneto

@kamilogorek or @AbhiPrasad do you know how this integration work on the browser SDK? what would we need to do to integrate that with the RN SDK? if it's just a session id set in the event context, that would be easy, but I believe it's not that.

marandaneto avatar Mar 04 '22 13:03 marandaneto

if it's just a session id set in the event context, that would be easy, but I believe it's not that.

That's exactly that 😄

https://github.com/getsentry/sentry-fullstory/blob/fda19a83ba5744d94522c6631f711037b84e5b23/src/SentryFullStory.ts#L33-L72

kamilogorek avatar Mar 04 '22 13:03 kamilogorek

So technically one could just:

// Install fullstory on RN App
yarn add @sentry/fullstory

// Add SentryFullStory to the integrations list during Sentry SDK init
Sentry.init({
  dsn: '__DSN__',
  integrations: [ new SentryFullStory('__SENTRY_ORG_SLUG__'), ],
  // ...
});

@TannerLessen have you tried this?

marandaneto avatar Mar 04 '22 13:03 marandaneto

@marandaneto Yes I tried that originally as we make use of this integration in one of our React projects. However it fails due to a dependency on @fullstory/browser, which we do not use since we leverage the React Native FullStory SDK (@fullstory/react-native)

This feature request was to have a similar integration that functions with @fullstory/react-native as opposed to @fullstory/browser.. if feasible.

Let me know how to proceed if I've missed something!

TannerLessen avatar Mar 04 '22 16:03 TannerLessen

Oh I see, that makes sense, we'd need an integration for @fullstory/react-native, indeed.

marandaneto avatar Mar 08 '22 15:03 marandaneto

I did some comparison between the react-native and browser packages and here's what I came up with as a potential solution:

  1. Create a new package (a clone of @sentry/fullstory) for the react-native specific implementation (@sentry/fullstory-react-native)
  2. Replace the browser dependencies with the react-native ones
  3. There are some minor refactoring that reflects the differences between the browser and react-native dependencies
    • src/utils.ts:
      • Import the EventHint type from @sentry/types/types instead
    • src/types.ts:
      • Remove the arg from getCurrentSessionURL() and set the return type to Promise<string>
    • src/SentryFullStory.ts:
      • Change both imports to /react-native
      • Import FullStory as a default instead of * as FullStory, since that's how it's defined in the react-native package
      • Remove the Event and EventHint import statement
      • Remove the types of event and hint from the addGlobalEventProcessor, let TypeScript infer them

Would it make more sense to create a completely new package named '@sentry/fullstory-react-native', or create an integration script within the react native integrations directory?

Disclaimer: At the time of writing this comment I still haven't tested the actual functionality, but I'm curious of what you think is the right approach.

nikolovlazar avatar Oct 05 '22 18:10 nikolovlazar

I'm not sure if this would be possible, but what about decoupling the @sentry/fullstory from the @fullstory/browser. Then based on the FullstoryClient supplied the implementation could work for both browser and rn?

krystofwoldrich avatar Oct 17 '22 17:10 krystofwoldrich