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 protocol #1038

Merged
merged 36 commits into from
Oct 12, 2022
Merged

Update protocol #1038

merged 36 commits into from
Oct 12, 2022

Conversation

ueman
Copy link
Collaborator

@ueman ueman commented Oct 2, 2022

📜 Description

Update protocol. I've also cleaned up some more toJson methods.

💡 Motivation and Context

Fixes #1028

💚 How did you test it?

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

@codecov-commenter
Copy link

codecov-commenter commented Oct 2, 2022

Codecov Report

Base: 90.45% // Head: 91.37% // Increases project coverage by +0.91% 🎉

Coverage data is based on head (37dbdeb) compared to base (559d28f).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1038      +/-   ##
==========================================
+ Coverage   90.45%   91.37%   +0.91%     
==========================================
  Files         114        9     -105     
  Lines        3584      197    -3387     
==========================================
- Hits         3242      180    -3062     
+ Misses        342       17     -325     
Impacted Files Coverage Δ
...art/lib/src/http_client/failed_request_client.dart
dart/lib/src/protocol/breadcrumb.dart
dart/lib/src/protocol/debug_image.dart
dart/lib/src/protocol/debug_meta.dart
dart/lib/src/protocol/mechanism.dart
dart/lib/src/protocol/sdk_info.dart
dart/lib/src/protocol/sdk_version.dart
dart/lib/src/protocol/sentry_app.dart
dart/lib/src/protocol/sentry_browser.dart
dart/lib/src/protocol/sentry_exception.dart
... and 95 more

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.

@ueman ueman marked this pull request as ready for review October 2, 2022 15:46
@@ -0,0 +1,29 @@
/// Geographical location of the end user or device.
class SentryGeo {
Copy link
Contributor

Choose a reason for hiding this comment

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

Documented here but not here.
I will check if this is inferred by the ip_address on the server side or if SDKs can actually set it as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is inferred from ip_address in the server, but if its set, it keeps as it is, I'm checking if SDKs should be allowed to set their own geo data.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep it, I will update the develop docs.
We have to fix the Native bridges, to also sync the geo data.
Such as Android:

private fun setUser(user: Map<String, Any?>?, result: Result) {
if (user == null) {
Sentry.setUser(null)
result.success("")
return
}
val userInstance = User()
(user["email"] as? String)?.let { userInstance.email = it }
(user["id"] as? String)?.let { userInstance.id = it }
(user["username"] as? String)?.let { userInstance.username = it }
(user["ip_address"] as? String)?.let { userInstance.ipAddress = it }
(user["extras"] as? Map<String, Any?>)?.let { extras ->
val others = mutableMapOf<String, String>()
for ((key, value) in extras.entries) {
if (value != null) {
others[key] = value.toString()
}
}
userInstance.others = others
}
Sentry.setUser(userInstance)
result.success("")
}

iOS
private func setUser(user: [String: Any?]?, result: @escaping FlutterResult) {
if let user = user {
let userInstance = User()
if let email = user["email"] as? String {
userInstance.email = email
}
if let id = user["id"] as? String {
userInstance.userId = id
}
if let username = user["username"] as? String {
userInstance.username = username
}
if let ipAddress = user["ip_address"] as? String {
userInstance.ipAddress = ipAddress
}
if let extras = user["extras"] as? [String: Any] {
userInstance.data = extras
}
SentrySDK.setUser(userInstance)
} else {
SentrySDK.setUser(nil)
}
result("")
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will do, but why is it this cumbersome to set the user on the native layer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Both, Cocoa and Java, don't have the Geo object yet. I've added the data sync though

Copy link
Contributor

@marandaneto marandaneto Oct 10, 2022

Choose a reason for hiding this comment

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

getsentry/team-mobile#59 (comment)
Added a comment on the geo field on Dart that this is not going to be synced for now (scope sync).
I will see if I can get this done on both.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or maybe we add it under data for now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I went for the solution of documenting the missing sync

Copy link
Contributor

Choose a reason for hiding this comment

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

Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com>
dart/lib/src/scope.dart Outdated Show resolved Hide resolved
dart/lib/src/scope.dart Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
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.

left a comment.

flutter/ios/Classes/SentryFlutterPluginApple.swift Outdated Show resolved Hide resolved
@ueman
Copy link
Collaborator Author

ueman commented Oct 12, 2022

There seems to be an issue with the NDK installation, do you know why that's happening, @marandaneto?

Checking the license for package NDK (Side by side) 21.4.7075529 in /usr/local/lib/android/sdk/licenses
License for package NDK (Side by side) 21.4.7075529 accepted.
Preparing "Install NDK (Side by side) 21.4.7075529 (revision: 21.4.7075529)".
Warning: An error occurred while preparing SDK package NDK (Side by side) 21.4.7075529: archive is not a ZIP archive.:
...
"Install NDK (Side by side) 21.4.[707](https://github.com/getsentry/sentry-dart/actions/runs/3228373240/jobs/5284386206#step:11:708)5529 (revision: 21.4.70[755](https://github.com/getsentry/sentry-dart/actions/runs/3228373240/jobs/5284386206#step:11:756)29)" failed.

@marandaneto
Copy link
Contributor

There seems to be an issue with the NDK installation, do you know why that's happening, @marandaneto?

Checking the license for package NDK (Side by side) 21.4.7075529 in /usr/local/lib/android/sdk/licenses
License for package NDK (Side by side) 21.4.7075529 accepted.
Preparing "Install NDK (Side by side) 21.4.7075529 (revision: 21.4.7075529)".
Warning: An error occurred while preparing SDK package NDK (Side by side) 21.4.7075529: archive is not a ZIP archive.:
...
"Install NDK (Side by side) 21.4.[707](https://github.com/getsentry/sentry-dart/actions/runs/3228373240/jobs/5284386206#step:11:708)5529 (revision: 21.4.70[755](https://github.com/getsentry/sentry-dart/actions/runs/3228373240/jobs/5284386206#step:11:756)29)" failed.

I suspect

// TODO: we need to fix CI as the version 21.1 (default) is not installed by default on
// GH Actions.
ndkVersion "21.4.7075529" // windows requires 21.4.7075529

Maybe GH action images changed, since this is the sample, feel free to either remove it or use a version that works, as long as CI is happy.

@ueman
Copy link
Collaborator Author

ueman commented Oct 12, 2022

Ci is now happy 🎉

@@ -4,6 +4,7 @@

### Fixes

- Bring protocol up to date with latest Sentry protocol ([#1038](https://github.com/getsentry/sentry-dart/pull/1038))
Copy link
Contributor

Choose a reason for hiding this comment

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

We have to move to unreleased section

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed it. You're doing way too many releases lately, I can barely keep up with it :D

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 a lot @ueman

@marandaneto marandaneto enabled auto-merge (squash) October 12, 2022 11:27
@marandaneto marandaneto merged commit 5d15a51 into getsentry:main Oct 12, 2022
@ueman ueman deleted the fix-protocol branch October 12, 2022 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing or deprecated fields on the event protocol
3 participants