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

Update sentry_dio to dio 5 #1282

Merged
merged 10 commits into from
Mar 2, 2023
Merged

Conversation

ueman
Copy link
Collaborator

@ueman ueman commented Feb 13, 2023

📜 Description

Dio changed in ownership to the guys behind diox, which previously was forked from dio.
Since the ownership changed, they've published diox v5 also as dio v5.
This PR makes the necessary changes to be compatible.

💡 Motivation and Context

Compatibility with dio v5

💚 How did you test it?

Tests

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

@codecov
Copy link

codecov bot commented Feb 13, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change

Comparison is base (2af98bf) 90.53% compared to head (d77f04f) 90.53%.

Additional details and impacted files
@@           Coverage Diff           @@
##           v7.0.0    #1282   +/-   ##
=======================================
  Coverage   90.53%   90.53%           
=======================================
  Files          50       50           
  Lines        1649     1649           
=======================================
  Hits         1493     1493           
  Misses        156      156           
Impacted Files Coverage Δ
dio/lib/src/breadcrumb_client_adapter.dart 80.00% <ø> (ø)
dio/lib/src/sentry_dio_client_adapter.dart 83.33% <ø> (ø)
dio/lib/src/tracing_client_adapter.dart 85.71% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

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

@krystofwoldrich
Copy link
Member

krystofwoldrich commented Feb 13, 2023

Thanks, it looks good, but CI is not happy yet. :)

@kuhnroyal
Copy link
Contributor

There are a few things missing.

@ueman
Copy link
Collaborator Author

ueman commented Feb 13, 2023

Thanks, it looks good, but CI is not happy yet. :)

I'll look at it later.

There are a few things missing.

What did I miss?

@kuhnroyal
Copy link
Contributor

Thanks, it looks good, but CI is not happy yet. :)

I'll look at it later.

There are a few things missing.

What did I miss?

Nah all good, sorry. I was still working on the 6.x branch.

@kuhnroyal
Copy link
Contributor

Would be great if we can get this in a new 7.0.0 beta asap.

@ueman
Copy link
Collaborator Author

ueman commented Feb 14, 2023

Would be great if we can get this in a new 7.0.0 beta asap.

I'm on it 🚀

expect(e.message, 'Exception: test');
expect(e.error.toString(), 'Exception: test');
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is due to changes in dio

@@ -75,7 +75,6 @@ void main() {
expect(processedEvent.request?.queryString, 'foo=bar');
expect(processedEvent.request?.headers, <String, String>{
'foo': 'bar',
'content-type': 'application/json; charset=utf-8'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

dio doesn't apply a content-type by itself anymore

@ueman ueman marked this pull request as ready for review February 15, 2023 11:48
Copy link
Collaborator

@brustolin brustolin left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@krystofwoldrich krystofwoldrich left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@ueman
Copy link
Collaborator Author

ueman commented Feb 16, 2023

Is there something left to do before it can be merged?

@krystofwoldrich
Copy link
Member

@ueman I think it's ready, just let's update the changelog to show this as a breaking change.

CHANGELOG.md Outdated Show resolved Hide resolved
@kuhnroyal
Copy link
Contributor

Would love to get a beta release with this :)

@ueman ueman mentioned this pull request Feb 22, 2023
@ueman
Copy link
Collaborator Author

ueman commented Feb 28, 2023

The pipeline still has one failing job, but it's for the pure Dart SDK. Since that's not touch in this PR, I'm wondering whether that's just a flake. Can someone rerun the jobs?

Edit: Apparently, that job is failing for all PRs which target the v7 branch, so it's unrelated to this PR.

@marandaneto
Copy link
Contributor

marandaneto commented Feb 28, 2023

@ueman

The build_web_compilers version – 3.2.7 – is not within the allowed constraint – ^4.0.0.

We have to upgrade build_web_compilers to ^4.0.0 and build_runner to ^2.4.0 cus the beta channel uses Dart 3 and the new versions require Dart 3.
Pretty much the inverse of #1299
Can be another PR since its not related to this issue.

@marandaneto
Copy link
Contributor

I will look into this tomorrow, sorry about the delay, just came back from vacation and catching up with all the pending things.

@ueman
Copy link
Collaborator Author

ueman commented Feb 28, 2023

No worries, thanks for looking into it.

Copy link
Contributor

@marandaneto marandaneto left a comment

Choose a reason for hiding this comment

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

Thanks for doing this @ueman

@marandaneto
Copy link
Contributor

Mind appending the migration page?

@ueman
Copy link
Collaborator Author

ueman commented Mar 2, 2023

Mind appending the migration page?

Sure. Is there anything in particular you'd like to see?

Edit: It's here getsentry/sentry-docs#6400

@marandaneto marandaneto merged commit 0034370 into getsentry:v7.0.0 Mar 2, 2023
@ueman ueman deleted the update-to-dio-5 branch March 2, 2023 09:36
@kuhnroyal
Copy link
Contributor

I have tested this change excessively over the last few days and the whole update from Sentry 6.x/Dio 4.x to Sentry 7.0/Dio 5.0 is a big step back regarding traceability of the DioError. This is in big part due to changes in dio which removed the whole source stacktrace. But due to the DioErrorExtractor there are now also cases where the inner stacktrace of DioError.error.stacktrace is completely missing in the event.

I think the DioError.stacktrace needs to be added by default, as it was the case in 6.x and only the inner cause error/stacktrace should be extracted via the DioErrorExtractor.

Something like:

class DioErrorExtractor extends ExceptionCauseExtractor<DioError> {
  @override
  ExceptionCause? cause(DioError error) {
    if (error.error == null) {
      return null;
    }
    return ExceptionCause(
      error.error,
      error.error is Error ? (error.error as Error).stackTrace : null,
    );
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants