-
-
Notifications
You must be signed in to change notification settings - Fork 242
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
Feature: Improve Dio exception reports #718
Conversation
I never get any |
This works, I have the correct in-app grouping. |
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.
I basically copied this and and added some more code from FailedRequestClient
in order to add a SentryRequest
to the event. And I disabled the FailedRequestClient
. This combination now gives me a pretty good result.
The only problem I see, is that the error is not tied to the transaction in any way.
That's actually a pretty good idea.
As this integration doesn't start any transactions, you basically have to write code like the one below anyway final transaction = Sentry.getSpan() ??
Sentry.startTransaction(
'dio-web-request',
'request',
bindToScope: true,
);
try {
final response = await dio.get<String>('https://flutter.dev/');
transaction.spanStatus = SpanStatus.ok();
} catch (exception, stackTrace) {
transaction.throwable = exception;
transaction.spanStatus = SpanStatus.internalError();
Sentry.captureException(exception, stacktrace);
} finally {
await transaction.finish();
} and then it is tied together. |
True, it is all tied to my Flutter route transactions. |
Codecov Report
@@ Coverage Diff @@
## main #718 +/- ##
==========================================
+ Coverage 90.53% 91.93% +1.39%
==========================================
Files 104 18 -86
Lines 3328 533 -2795
==========================================
- Hits 3013 490 -2523
+ Misses 315 43 -272 Continue to review full report at Codecov.
|
Co-authored-by: Peter Leibiger <[email protected]>
Yeah, that's also true for |
I agree, an issue there would be better, I don't know the answer either. |
# Conflicts: # dio/lib/src/sentry_dio_extension.dart
dio/lib/src/dio_event_processor.dart
Outdated
if (innerDioErrorException.runtimeType == String) { | ||
innerException = | ||
innerException.copyWith(type: 'DioError inner stacktrace'); | ||
} |
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.
What's the reason for not using it's type? String
in this case.
@ueman can you share a link of an issue after those changes or a screenshot? thanks. |
|
@marandaneto, as you said, code looks good. |
Feel free to ask (here or on Discord), I'll probably can answer at least some questions. |
@ueman sentry-dio / package-analysis is unhappy, otherwise LGTM. |
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.
@ueman thanks for making the dio
integration better :)
@kuhnroyal also thanks for the valuable tests and insights. |
I would guess it's because pana doesn't check the dependency overrides? The getter which pana complains about isn't available in the latest stable but on main. I don't think I can do anything about that. Pana isn't happy because of: [x] 0/30 points: code has no errors, warnings, lints, or formatting issuesFound 3 issues. Showing the first 2: ERROR: The getter 'exceptionFactory' isn't defined for the type 'SentryOptions'.`lib/src/dio_event_processor.dart:20:16```` ╷ 20 │ _options.exceptionFactory; │ ^^^^^^^^^^^^^^^^ ╵ ``` To reproduce make sure you are using the [lints_core](https://pub.dev/packages/lints) and run `dart analyze lib/src/dio_event_processor.dart`ERROR: The method 'shouldAddBody' isn't defined for the type 'MaxRequestBodySize'.`lib/src/dio_event_processor.dart:127:31` ``` ╷ 127 │ if (_maxRequestBodySize.shouldAddBody(data.codeUnits.length)) { │ ^^^^^^^^^^^^^ ╵ ``` To reproduce make sure you are using the [lints_core](https://pub.dev/packages/lints) and run `dart analyze lib/src/dio_event_processor.dart` |
Indeed, I believe |
I'm fine if you want to address #718 (comment) or keep as it is, your call. |
📜 Description
Adds an event processor, which add chained exceptions for the inner exception of
DioError
,see https://sentry.io/share/issue/638a3758a43d4f61bc2a0c62acdefd69/
This one should be merged after #728
💡 Motivation and Context
Fixes #715
💚 How did you test it?
📝 Checklist
🔮 Next steps