-
-
Notifications
You must be signed in to change notification settings - Fork 277
Add support for Contexts interface #40
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
Conversation
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
|
Signed the CLA! |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
|
Any update on this? Would be great to get this merged. |
yjbanov
left a comment
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.
This change also requires tests.
lib/sentry.dart
Outdated
| break; | ||
| } | ||
|
|
||
| if (name != null) json['name'] = name; |
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.
For consistency let's use { } block syntax everywhere.
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.
Are you sure? I was doing this because this is done in existing code already for serialization. So it would be less consistent with existing code, if you look at Event.toJson for example.
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 was looking around line 758. More generally Flutter style guide wants to do this: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#separate-the-if-expression-from-its-statement. The easiest way to make that work with dartfmt is to use braces.
However, this repo has been pretty lax about style, so I do not insist.
|
Sorry for the delay. If you are still interested in making this change, I'm around to review it. Thanks for the contribution! |
|
Cool, will take a look at the suggestions! |
|
@wilkomanger Are you still interested in merging this PR? The changes LGTM. It just needs some unit tests and it should be good to go. |
|
Yes, I will do that next week! |
|
Would it be possible to allow passing a context into |
|
@wilkomanger would you still able to update this PR and add unit tests? |
|
@wilkomanger if you don't have time to work on it right now, I can have a go at getting this PR rebased and adding some unit tests for it? |
|
@maks That'd be great, thanks! Maybe PR it to my fork and then I can let this PR get approved with the tests? |
Maybe you could do that after this PR is merged in a separate one, if it's possible |
|
And sorry about the delay everyone, I was/am kinda busy and forgot about it! |
|
👍 @wilkomanger I'll get to work on that and raise PR against your repo. |
|
@wilkomanger ok done, I've got a PR against the branch in your repo: wilkomanger#1 that gets it up to date with master from here and adds a test for the json generated (simliar to what events test). There was alot for code churn here when the web support PR got merged, so the change is actually against the base file now. |
Contexts update to upstream, add test, bugfixes
|
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
|
@maks Thank you! |
|
@googlebot I consent. |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
boottime test independent of test machine timezone
|
@yjbanov is there any thing else that is needed to get this merged? |
Is this ready for review? LMK and I'll do another pass. |
|
@yjbanov thanks! Yes please, its ready for another review now. |
yjbanov
left a comment
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.
This looks pretty clean! I only have one small nitpick for the test.
Other than that, let's update CHANGELOG.md, bump the version to 3.0.1, and it's good to go. Thanks!
| final testApp = App(version: '1.2.3'); | ||
| final testBrowser = Browser(version: '12.3.4'); | ||
|
|
||
| final contexts = Contexts( |
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 put this in an Event instance, then call event.toJson() and expect(eventJson['contexts'], ...);. This will also test the logic in Event.toJson().
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.
@yjbanov test improved, changelog updated and version bumped in latest commit.
bruno-garcia
left a comment
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.
Really nice to see this landing in the Dart sdk
| } | ||
| } | ||
|
|
||
| json[key] = runtime.toJson()..addAll({"type": "runtime"}); |
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.
Curious if this runtime list approach exists on another Sentry SDK and if yes which one?
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'm not sure, I made it so that in theory you don't have to specify keys or can even specify conflicting ones, from what I remember.
| this.freeStorage, | ||
| this.externalStorageSize, | ||
| this.externalFreeStorage, | ||
| this.bootTime, |
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 recently added some new fields which I Don't think made it to the docs yet. Not at the computer right now but I can check later and make a PR.
|
|
||
| if (modelId != null) json['model_id'] = modelId; | ||
|
|
||
| if (arch != null) json['arch'] = arch; |
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 added archs too now for devices with more than one cpu
|
Thanks @bruno-garcia,I'd be happy to do those in a followup PR as I'm quite keen to get this one merged first if possible. |
improve test, version bump and changelog
match reported SDK version to version in pubspec
|
Awesome! Thank you! Merging and will publish the new version to pub shortly. |
| final String screenResolution; | ||
|
|
||
| /// A floating point denoting the screen density. | ||
| final String screenDensity; |
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.
This has to be a double. I get the following error from Sentry:
There was 1 error encountered while processing this event
contexts.device.screen_density: Discarded invalid value
| Reason | expected a floating point number |
|---|---|
| Value | 2.625 |
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.
Good point. Just reviewed the docs and it says:
Optional. A floating point denoting the screen density.
I'll review the types and open a PR to fix this
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.
Thanks! Also filed flutter/flutter#53521.
No description provided.