sentry-javascript
sentry-javascript copied to clipboard
Add optional `graphqlClientIntegration` to `@sentry/browser`
Description
Similar to https://github.com/getsentry/sentry-cocoa/pull/3931, we can add a pluggable (=not enabled by default) integration to @sentry/browser (and downstream SDKs) which allows to opt-in to get better breadcrumbs & spans when using GraphQL as a client.
This could behave like this:
Sentry.init({
integrations: [
Sentry.graphqlClientIntegration({
endpoints: ['/graphql'],
})
]
})
Where any http.client span or breadcrumb created that matches endpoints will be enhanced with graphql data from the request payload:
- For
http.clientspans, we can update the span name similar to what we do here in node: https://github.com/getsentry/sentry-javascript/pull/13248 - For breadcrumbs, we can add the operation name to the breadcrumb data (and possibly also the query itself)
related: https://github.com/getsentry/sentry-javascript/issues/13215