-
-
Notifications
You must be signed in to change notification settings - Fork 234
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
capture response body for failed requests and if tracing is enabled in SentryHttpClient #2293
base: main
Are you sure you want to change the base?
capture response body for failed requests and if tracing is enabled in SentryHttpClient #2293
Conversation
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
- capture response body for failed requests and if tracing is enabled in SentryHttpClient ([#2293](https://github.com/getsentry/sentry-dart/pull/2293)) If none of the above apply, you can opt out of this check by adding |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2293 +/- ##
==========================================
- Coverage 88.35% 86.93% -1.42%
==========================================
Files 247 104 -143
Lines 8578 3713 -4865
==========================================
- Hits 7579 3228 -4351
+ Misses 999 485 -514 ☔ View full report in Codecov by Sentry. |
iOS Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
d8f5abb | 1237.73 ms | 1259.13 ms | 21.39 ms |
f275487 | 1291.65 ms | 1339.92 ms | 48.26 ms |
fcd1ee4 | 1247.18 ms | 1251.35 ms | 4.16 ms |
f7f46dc | 1285.82 ms | 1315.06 ms | 29.24 ms |
ba9c106 | 1241.76 ms | 1265.15 ms | 23.40 ms |
77db8d4 | 1228.47 ms | 1248.80 ms | 20.33 ms |
ccc09e4 | 1254.74 ms | 1277.08 ms | 22.34 ms |
dd933d4 | 1238.73 ms | 1252.43 ms | 13.70 ms |
d883d62 | 1221.39 ms | 1230.18 ms | 8.80 ms |
6034b0a | 1244.89 ms | 1270.22 ms | 25.33 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
d8f5abb | 8.33 MiB | 9.40 MiB | 1.07 MiB |
f275487 | 8.32 MiB | 9.38 MiB | 1.05 MiB |
fcd1ee4 | 8.29 MiB | 9.36 MiB | 1.07 MiB |
f7f46dc | 8.10 MiB | 9.17 MiB | 1.08 MiB |
ba9c106 | 8.32 MiB | 9.38 MiB | 1.06 MiB |
77db8d4 | 8.38 MiB | 9.73 MiB | 1.35 MiB |
ccc09e4 | 8.16 MiB | 9.16 MiB | 1.01 MiB |
dd933d4 | 8.33 MiB | 9.64 MiB | 1.31 MiB |
d883d62 | 8.29 MiB | 9.36 MiB | 1.07 MiB |
6034b0a | 8.33 MiB | 9.40 MiB | 1.07 MiB |
"All Request and Responses are now logged, if `sendDefaultPii` is `true` and `maxRequestBodySize` and `maxResponseBodySize` conditions are met.") | ||
bool captureFailedRequests = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's rethink this, I don't think deprecating this flag is the right way to go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we still want to provide this flag to disable capturing of failed network requests completely, so yes we shouldn't deprecate this
@kahest JS Replay uses getsentry/sentry-javascript#7589 wdyt if we also adopt this flag? |
I think this has since been dropped in favor of I like the new option - it makes it more granular and explicit, though of course it's more work. It's still only available for JS SR I think, so not widely adopted. If there's no competing option for other HTTP integrations on other SDKs, I'm fine with adopting this |
Ah I missed that, thx. I'll have a look at it |
@kahest I haven't found anything specific in other SDKs that allow sending http response bodies other than replay. However it's possible a user can do this: beforeSend: (event, hint) async {
final response = hint.get(TypeCheckHint.httpResponse);
if (response is StreamedResponse) {
final body = getResponseBody(response)
// user can now use it
}
} this also aligns with what the js http integration would like to add: getsentry/sentry-javascript#12544 |
@buenaflor IIUC this would work for http+dio? I like the idea, it's very flexible and allows users to decide based on endpoint etc. if they want to add, but of course it's more complex to use than a switch |
yes but only errors so this won't work for transactions (like the user in the referenced issue wants) because we don't have a system in place to pair hints with transactions I'll take a look for alternatives |
📜 Description
If
sendDefaultPii
is enabled andmaxResponseBodySize
is bigger than the responseBodySize, the body is logged in sentry.💡 Motivation and Context
close #2220
💚 How did you test it?
📝 Checklist
sendDefaultPii
is enabled🔮 Next steps