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

Support for automatically capturing Failed GraphQL (Apollo 3) Client errors #2781

Merged
merged 23 commits into from
Jun 13, 2023

Conversation

marandaneto
Copy link
Contributor

@marandaneto marandaneto commented Jun 7, 2023

📜 Description

Support GraphQL Client errors for Apollo v3

💡 Motivation and Context

Relates to getsentry/sentry#33723

💚 How did you test it?

Screenshot 2023-06-07 at 17 21 00
Screenshot 2023-06-07 at 17 21 13

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Docs and test with the FE bits.

@marandaneto
Copy link
Contributor Author

@lbloder can you give some feedback on this PR since I changed a few things you added?

@github-actions
Copy link
Contributor

github-actions bot commented Jun 7, 2023

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 310.82 ms 342.12 ms 31.30 ms
Size 1.72 MiB 2.28 MiB 571.72 KiB

Previous results on branch: chore/graphql_errors

Startup times

Revision Plain With Sentry Diff
44d22ce 314.00 ms 357.00 ms 43.00 ms
e3e3297 301.14 ms 354.78 ms 53.63 ms
72c927d 279.31 ms 317.98 ms 38.67 ms
6b513d9 311.94 ms 326.29 ms 14.35 ms
2483a35 293.88 ms 331.54 ms 37.66 ms
641268f 288.40 ms 354.54 ms 66.14 ms
4d9c9a7 260.75 ms 355.40 ms 94.65 ms
eac6dd1 305.90 ms 378.14 ms 72.24 ms
efb1927 292.00 ms 348.86 ms 56.86 ms
741ec32 248.92 ms 348.82 ms 99.90 ms

App size

Revision Plain With Sentry Diff
44d22ce 1.72 MiB 2.28 MiB 571.72 KiB
e3e3297 1.72 MiB 2.28 MiB 571.65 KiB
72c927d 1.72 MiB 2.28 MiB 571.72 KiB
6b513d9 1.72 MiB 2.28 MiB 571.72 KiB
2483a35 1.72 MiB 2.28 MiB 571.72 KiB
641268f 1.72 MiB 2.28 MiB 571.72 KiB
4d9c9a7 1.72 MiB 2.28 MiB 571.72 KiB
eac6dd1 1.72 MiB 2.28 MiB 571.65 KiB
efb1927 1.72 MiB 2.28 MiB 571.72 KiB
741ec32 1.72 MiB 2.28 MiB 571.72 KiB

@lbloder
Copy link
Collaborator

lbloder commented Jun 7, 2023

@marandaneto Will do. Probably sometime tomorrow

Copy link
Collaborator

@lbloder lbloder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM apart from the body size that I commented on.
And the tests need to be adapted, extended, of course to cover the error handling as well.
Thanks @marandaneto

@codecov
Copy link

codecov bot commented Jun 12, 2023

Codecov Report

Patch coverage: 80.73% and project coverage change: +0.02 🎉

Comparison is base (57d88b9) 81.11% compared to head (f355e91) 81.13%.

❗ Current head f355e91 differs from pull request most recent head 029f342. Consider uploading reports for the commit 029f342 to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2781      +/-   ##
============================================
+ Coverage     81.11%   81.13%   +0.02%     
- Complexity     4479     4493      +14     
============================================
  Files           347      348       +1     
  Lines         16510    16659     +149     
  Branches       2238     2263      +25     
============================================
+ Hits          13392    13517     +125     
- Misses         2183     2197      +14     
- Partials        935      945      +10     
Impacted Files Coverage Δ
...java/io/sentry/apollo3/SentryApollo3Interceptor.kt 61.53% <ø> (-2.75%) ⬇️
sentry/src/main/java/io/sentry/SentryOptions.java 79.95% <50.00%> (ø)
...io/sentry/apollo3/SentryApolloBuilderExtensions.kt 60.00% <55.55%> (+10.00%) ⬆️
.../io/sentry/apollo3/SentryApollo3HttpInterceptor.kt 83.82% <83.16%> (+2.64%) ⬆️
.../io/sentry/apollo3/SentryApollo3ClientException.kt 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@marandaneto marandaneto changed the title GraphQL (Apollo) Client errors Support for automatically capturing Failed GraphQL (Apollo 3) Client errors Jun 12, 2023
@marandaneto marandaneto marked this pull request as ready for review June 12, 2023 14:02
@marandaneto marandaneto requested a review from lbloder June 12, 2023 14:03
Copy link
Member

@romtsn romtsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, looks dope 🚀

CHANGELOG.md Show resolved Hide resolved
sentry-android-ndk/sentry-native Outdated Show resolved Hide resolved

val breadcrumb = Breadcrumb.http(request.url, request.method.name, statusCode)

request.body?.contentLength.ifHasValidLength { contentLength ->
breadcrumb.setData("request_body_size", contentLength)
}

operationName?.let {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: should we prefix these with graphql.?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually what I want is to extend https://develop.sentry.dev/sdk/event-payloads/breadcrumbs/ adding a new type and category for crumbs specifically to graphql, I am checking this on the FE first, we can easily decide to change it later since data is not indexed anyway, if we do that, graph.$something is redundant because the category is already graphql.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, that makes sense 👍

@marandaneto
Copy link
Contributor Author

@romtsn thanks for the review, fixed a few things and replied to some others, is it fine? just wanna double check after my last changes although it's approved :)

@romtsn
Copy link
Member

romtsn commented Jun 13, 2023

@romtsn thanks for the review, fixed a few things and replied to some others, is it fine? just wanna double check after my last changes although it's approved :)

yeah looks good 👍

@marandaneto marandaneto enabled auto-merge (squash) June 13, 2023 11:20
@marandaneto marandaneto merged commit 4ab3672 into main Jun 13, 2023
@marandaneto marandaneto deleted the chore/graphql_errors branch June 13, 2023 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants