getsentry / sentry-dart

Sentry SDK for Dart and Flutter
https://sentry.io/for/flutter/
MIT License
752 stars 234 forks source link

Support `graphql` APM/Breadcrumbs #1126

Open marandaneto opened 1 year ago

marandaneto commented 1 year ago

Description

https://pub.dev/packages/graphql_flutter https://pub.dev/packages/graphql https://pub.dev/documentation/graphql/latest/graphql/QueryResult-class.html https://pub.dev/documentation/graphql/latest/graphql/GraphQLClient-class.html Example https://github.com/ueman/sentry-dart-tools/tree/main/sentry_graphql

ueman commented 1 year ago

Actually, the better example is sentry_link. sentry_graphql (permalink to before deletion) doesn't really add value over the link integrations and I've deleted it since. The link integration is also more versatile, since it integrates into a couple different GraphQL clients as mentioned in it's readme.

I'm also open to transfer ownership of the https://pub.dev/packages/sentry_link package, if there's interest.

marandaneto commented 1 year ago

https://github.com/DiederikvandenB/apollo-link-sentry also uses the Link approach for RN, so using the Link approach would be the way to go.

marandaneto commented 1 year ago

Worth checking this discussion before tackling this issue.

ueman commented 1 year ago

Also, this https://github.com/getsentry/sentry/issues/33723 issue, but I don't think it will be tackled soon.

marandaneto commented 1 year ago

I'll drop Client errors for now unless it throws an exception.

Unlike REST APIs, GraphQL servers don’t use HTTP status codes to indicate unsuccessful requests. Instead, the GraphQL response body includes an array of errors when an operation fails.

The SDK would need to read and deserialize the payload, we'd need to decide if we actually wanna do it and if the response payload is standardized across different Graph implementations.

ueman commented 1 year ago

The SDK would need to read and deserialize the payload, we'd need to decide if we actually wanna do it and if the response payload is standardized across different Graph implementations.

An additional problem is, that you can have partial errors with GraphQL. The error response is standardized, as seen here.

ueman commented 2 weeks ago

I'm in the future no longer working with Sentry (😭) and also not longer with GraphQL, so I would like to hand over ownership of https://pub.dev/packages/sentry_link to you. It currently has a popularity of 80%, so it's quite popular (even more than some of your first party integrations), and otherwise I would feel bad to just mark it as deprecated. I also haven't received any bug reports/feature request in the recent past, so seems pretty stable and feature complete.

I'm happy to create a PR for moving the code. Regarding the package on pub, I'm happy to discuss how to transfer it via Discord, since it would be really nice if current users would receive new updates from you via the same package.