Skip to content

Update sentry_dio to dio 5#1282

Merged
marandaneto merged 10 commits into
getsentry:v7.0.0from
ueman:update-to-dio-5
Mar 2, 2023
Merged

Update sentry_dio to dio 5#1282
marandaneto merged 10 commits into
getsentry:v7.0.0from
ueman:update-to-dio-5

Conversation

@ueman

@ueman ueman commented Feb 13, 2023

Copy link
Copy Markdown
Collaborator

📜 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

codecov Bot commented Feb 13, 2023

Copy link
Copy Markdown

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

krystofwoldrich commented Feb 13, 2023

Copy link
Copy Markdown
Contributor

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

@kuhnroyal

Copy link
Copy Markdown
Contributor

There are a few things missing.

@ueman

ueman commented Feb 13, 2023

Copy link
Copy Markdown
Collaborator Author

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
Copy Markdown
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
Copy Markdown
Contributor

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

@ueman

ueman commented Feb 14, 2023

Copy link
Copy Markdown
Collaborator Author

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

I'm on it 🚀

fail('Method did not throw');
} on DioError catch (e) {
expect(e.message, 'Exception: test');
expect(e.error.toString(), 'Exception: test');

Copy link
Copy Markdown
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

expect(processedEvent.request?.queryString, 'foo=bar');
expect(processedEvent.request?.headers, <String, String>{
'foo': 'bar',
'content-type': 'application/json; charset=utf-8'

Copy link
Copy Markdown
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

Comment thread flutter/example/pubspec.yaml
@ueman
ueman marked this pull request as ready for review February 15, 2023 11:48

@brustolin brustolin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@krystofwoldrich krystofwoldrich left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 🚀

@ueman

ueman commented Feb 16, 2023

Copy link
Copy Markdown
Collaborator Author

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

@krystofwoldrich

Copy link
Copy Markdown
Contributor

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

Comment thread CHANGELOG.md Outdated
@kuhnroyal

Copy link
Copy Markdown
Contributor

Would love to get a beta release with this :)

@ueman ueman mentioned this pull request Feb 22, 2023
@ueman

ueman commented Feb 28, 2023

Copy link
Copy Markdown
Collaborator Author

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

marandaneto commented Feb 28, 2023

Copy link
Copy Markdown
Contributor

@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
Copy Markdown
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

ueman commented Feb 28, 2023

Copy link
Copy Markdown
Collaborator Author

No worries, thanks for looking into it.

@marandaneto marandaneto left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

Mind appending the migration page?

@ueman

ueman commented Mar 2, 2023

Copy link
Copy Markdown
Collaborator Author

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
Copy Markdown
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