Capture event for HTTP requests resulted in server error#2287
Merged
marandaneto merged 43 commits intomainfrom Oct 20, 2022
Merged
Capture event for HTTP requests resulted in server error#2287marandaneto merged 43 commits intomainfrom
marandaneto merged 43 commits intomainfrom
Conversation
Contributor
|
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 221a5df | 350.61 ms | 391.58 ms | 40.97 ms |
| 4ca1d7b | 328.46 ms | 368.22 ms | 39.76 ms |
| 54cebc8 | 331.12 ms | 385.14 ms | 54.02 ms |
| 54cebc8 | 300.86 ms | 341.43 ms | 40.57 ms |
| 2c5f172 | 310.20 ms | 357.16 ms | 46.96 ms |
| 2c5f172 | 289.18 ms | 307.56 ms | 18.38 ms |
| 7300956 | 324.20 ms | 353.79 ms | 29.58 ms |
| c5ccd8a | 329.98 ms | 365.52 ms | 35.54 ms |
| d4087ee | 278.00 ms | 313.86 ms | 35.86 ms |
| 4ca1d7b | 331.33 ms | 335.78 ms | 4.45 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 221a5df | 1.73 MiB | 2.29 MiB | 581.39 KiB |
| 4ca1d7b | 1.73 MiB | 2.29 MiB | 579.88 KiB |
| 54cebc8 | 1.73 MiB | 2.29 MiB | 579.43 KiB |
| 54cebc8 | 1.73 MiB | 2.29 MiB | 579.43 KiB |
| 2c5f172 | 1.73 MiB | 2.29 MiB | 580.10 KiB |
| 2c5f172 | 1.73 MiB | 2.29 MiB | 580.10 KiB |
| 7300956 | 1.73 MiB | 2.29 MiB | 578.69 KiB |
| c5ccd8a | 1.74 MiB | 2.33 MiB | 607.44 KiB |
| d4087ee | 1.73 MiB | 2.29 MiB | 579.50 KiB |
| 4ca1d7b | 1.73 MiB | 2.29 MiB | 579.88 KiB |
Previous results on branch: feat/httpclienterrors
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 43e9f47 | 303.30 ms | 326.18 ms | 22.88 ms |
| 04bbe69 | 344.33 ms | 371.84 ms | 27.51 ms |
| 42cf10a | 333.70 ms | 401.86 ms | 68.16 ms |
| 25164ef | 328.60 ms | 341.86 ms | 13.26 ms |
| ab59cc7 | 348.10 ms | 375.40 ms | 27.30 ms |
| f0da475 | 361.31 ms | 383.85 ms | 22.54 ms |
| ae25959 | 347.51 ms | 372.73 ms | 25.22 ms |
| 4364835 | 393.85 ms | 454.24 ms | 60.39 ms |
| 0dbf473 | 317.16 ms | 338.70 ms | 21.54 ms |
| 09897d4 | 317.26 ms | 369.36 ms | 52.10 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 43e9f47 | 1.73 MiB | 2.29 MiB | 580.53 KiB |
| 04bbe69 | 1.73 MiB | 2.29 MiB | 580.53 KiB |
| 42cf10a | 1.73 MiB | 2.29 MiB | 580.26 KiB |
| 25164ef | 1.73 MiB | 2.29 MiB | 581.87 KiB |
| ab59cc7 | 1.73 MiB | 2.29 MiB | 580.51 KiB |
| f0da475 | 1.73 MiB | 2.32 MiB | 607.78 KiB |
| ae25959 | 1.73 MiB | 2.29 MiB | 580.53 KiB |
| 4364835 | 1.73 MiB | 2.29 MiB | 580.53 KiB |
| 0dbf473 | 1.73 MiB | 2.29 MiB | 581.87 KiB |
| 09897d4 | 1.73 MiB | 2.29 MiB | 580.26 KiB |
marandaneto
commented
Oct 11, 2022
sentry-android-okhttp/src/main/java/io/sentry/android/okhttp/SentryOkHttpInterceptor.kt
Outdated
Show resolved
Hide resolved
marandaneto
commented
Oct 11, 2022
sentry-android-okhttp/src/main/java/io/sentry/android/okhttp/SentryOkHttpInterceptor.kt
Outdated
Show resolved
Hide resolved
marandaneto
commented
Oct 11, 2022
sentry-android-okhttp/src/main/java/io/sentry/android/okhttp/SentryOkHttpInterceptor.kt
Outdated
Show resolved
Hide resolved
marandaneto
commented
Oct 11, 2022
sentry-android-okhttp/src/main/java/io/sentry/android/okhttp/SentryOkHttpInterceptor.kt
Outdated
Show resolved
Hide resolved
marandaneto
commented
Oct 11, 2022
sentry-android-okhttp/src/main/java/io/sentry/android/okhttp/SentryOkHttpInterceptor.kt
Outdated
Show resolved
Hide resolved
marandaneto
commented
Oct 12, 2022
sentry-android-okhttp/src/main/java/io/sentry/android/okhttp/SentryOkHttpInterceptor.kt
Outdated
Show resolved
Hide resolved
marandaneto
commented
Oct 12, 2022
sentry-android-okhttp/src/main/java/io/sentry/android/okhttp/SentryOkHttpInterceptor.kt
Outdated
Show resolved
Hide resolved
…sentry-java into feat/httpclienterrors
adinauer
reviewed
Oct 17, 2022
| hub.captureEvent(event, hint) | ||
| } | ||
|
|
||
| private fun containsStatusCode(statusCode: Int): Boolean { |
Member
There was a problem hiding this comment.
Maybe this could be called something like shouldStatusCodeCauseSentryEvent or similar?
Also should it be extracted into some util so it can be reused from other integrations?
Contributor
Author
There was a problem hiding this comment.
I don't think so, isInRange already can be reused.
In case the language has a built-in type for Range instead of HttpStatusCodeRange, they will need to implement this anyway.
Java does not have Range obj as part of the language.
sentry-android-okhttp/src/main/java/io/sentry/android/okhttp/SentryOkHttpInterceptor.kt
Outdated
Show resolved
Hide resolved
sentry-android-okhttp/src/main/java/io/sentry/android/okhttp/SentryOkHttpInterceptor.kt
Show resolved
Hide resolved
…sentry-java into feat/httpclienterrors
Contributor
Author
Member
|
@marandaneto will take a look later today or tomorrow 👍 |
romtsn
approved these changes
Oct 19, 2022
Member
romtsn
left a comment
There was a problem hiding this comment.
LGTM, besides some minor things 👍
sentry-android-okhttp/src/main/java/io/sentry/android/okhttp/SentryOkHttpInterceptor.kt
Show resolved
Hide resolved
sentry-android-okhttp/src/test/java/io/sentry/android/okhttp/SentryOkHttpInterceptorTest.kt
Outdated
Show resolved
Hide resolved
sentry-android-okhttp/src/main/java/io/sentry/android/okhttp/SentryOkHttpInterceptor.kt
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
HTTP Client errors such as bad response code are captured as error events and reported to Sentry. The error event will contain the
requestandresponsedata such asurl,status_code, and so on.User facing docs getsentry/sentry-docs#5651
💡 Motivation and Context
getsentry/team-mobile#38
💚 How did you test it?
📝 Checklist
🔮 Next steps