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

Support for Apollo in Sentry Performance

Open fabiendem opened this issue 4 years ago • 7 comments

Hello,

I am setting up the Sentry Performance monitoring on a React Native Project. Most of our queries are made via Apollo/GraphQL.

I see that you have a specific plugin for Sentry and Apollo on Android: https://docs.sentry.io/platforms/android/configuration/integrations/apollo/

I am wondering if there is such a plugin for React Native, knowing that the Apollo setup is made at the JS layer in our app. I couldn't find it in the docs or in the source code of the library.

Thanks

fabiendem avatar Jan 18 '22 16:01 fabiendem

@fabiendem we only have for the Android native layer, but not for the JS layer, I'll tag it as a feature request.

Feel free to use our custom instrumentation and do something similar to what's done in this blog post.

marandaneto avatar Jan 18 '22 16:01 marandaneto

@fabiendem You might be interested in this blogpost we have that details how to create a Sentry Plugin for Apollo: https://blog.sentry.io/2021/08/31/guest-post-performance-monitoring-in-graphql

jennmueng avatar Jan 18 '22 17:01 jennmueng

Interesting thanks, I'll have a look.

I don't want to divert from this ticket too much, but in the RN doc, what does tracingOrigins: ["localhost", "my-site-url.com", /^\//], refer to? Is that for Rest API tracking? i am struggling to understand the purpose of this tracingOrigins param.

https://docs.sentry.io/platforms/react-native/performance/#enable-tracing

fabiendem avatar Jan 18 '22 17:01 fabiendem

@fabiendem the JS docs may help to explain that https://docs.sentry.io/platforms/javascript/performance/instrumentation/automatic-instrumentation/#tracingorigins

marandaneto avatar Jan 18 '22 17:01 marandaneto

I tried to use https://github.com/DiederikvandenB/apollo-link-sentry to get the GQL query names instead of /graphql everywhere but it didn't seem t work.

sregg avatar Feb 11 '22 02:02 sregg

https://github.com/getsentry/sentry-javascript/pull/3953 should help here once we bump to JS 7.2.0

marandaneto avatar Jun 22 '22 08:06 marandaneto

Thanks @marandaneto but isn't it for server side queries only? It won't apply to a react-native project I believe.

fabiendem avatar Sep 01 '22 17:09 fabiendem

Hey FYI we're now using https://github.com/DiederikvandenB/apollo-link-sentry in our app. It's doing the job, feel free to close this ticket.

fabiendem avatar Dec 01 '22 14:12 fabiendem