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
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
4025afc
update protocol
ueman Oct 1, 2022
1cd84a8
formatting
ueman Oct 2, 2022
c4a77e5
add changelog
ueman Oct 2, 2022
5354e13
fix tests
ueman Oct 2, 2022
05280c1
clean up toJson methods
ueman Oct 2, 2022
cd2119b
fix mistake
ueman Oct 2, 2022
19305eb
Merge branch 'main' into fix-protocol
ueman Oct 3, 2022
79fd9be
Update dart/lib/src/protocol/sentry_user.dart
ueman Oct 3, 2022
2039ade
rename methods
ueman Oct 3, 2022
4999df7
Merge branch 'main' into fix-protocol
ueman Oct 3, 2022
e271671
don't remove extras
ueman Oct 3, 2022
b01c5f8
rename variables
ueman Oct 3, 2022
1268eff
remove subscription
ueman Oct 3, 2022
3afd2c5
add geo docs
ueman Oct 7, 2022
13c045b
Merge branch 'main' into fix-protocol
ueman Oct 7, 2022
01f46f7
Merge remote-tracking branch 'upstream/main' into fix-protocol
ueman Oct 8, 2022
adb4a77
remove inferred content type
ueman Oct 8, 2022
e82eeb3
add data to native layer
ueman Oct 8, 2022
7774ab3
fix formatting
ueman Oct 8, 2022
fabed94
add segment
ueman Oct 10, 2022
79ea6b2
merge data
ueman Oct 10, 2022
4aa6cc2
Merge branch 'main' into fix-protocol
ueman Oct 10, 2022
5beb837
fix changelog
ueman Oct 10, 2022
0d00a0f
Merge branch 'main' into fix-protocol
ueman Oct 10, 2022
cfa7f3b
fix swift lint
ueman Oct 10, 2022
dd483a4
Merge branch 'main' into fix-protocol
ueman Oct 10, 2022
299ed4f
Merge branch 'main' into fix-protocol
ueman Oct 11, 2022
3d0896c
Update dart/lib/src/protocol/sentry_user.dart
ueman Oct 11, 2022
dd564c7
Merge branch 'main' into fix-protocol
ueman Oct 11, 2022
279ada4
Update CHANGELOG.md
ueman Oct 11, 2022
6c7aee1
Merge branch 'main' into fix-protocol
marandaneto Oct 11, 2022
c2c38e5
Merge branch 'main' into fix-protocol
ueman Oct 11, 2022
60b99db
fix swift lint
ueman Oct 11, 2022
49eb822
Update build.gradle
ueman Oct 12, 2022
e5fdba9
Merge branch 'main' into fix-protocol
marandaneto Oct 12, 2022
37dbdeb
Update CHANGELOG.md
ueman Oct 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

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


## 6.11.2

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion dart/example_web/web/event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final event = SentryEvent(
username: 'first-user',
email: 'first@user.lan',
// ipAddress: '127.0.0.1',
extras: <String, String>{'first-sign-in': '2020-01-01'},
data: <String, String>{'first-sign-in': '2020-01-01'},
),
breadcrumbs: [
Breadcrumb(
Expand Down
2 changes: 1 addition & 1 deletion dart/example_web/web/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Future<void> runApp() async {
username: 'first-user',
email: 'first@user.lan',
// ipAddress: '127.0.0.1',
extras: <String, String>{'first-sign-in': '2020-01-01'},
data: <String, String>{'first-sign-in': '2020-01-01'},
),
);
});
Expand Down
1 change: 1 addition & 0 deletions dart/lib/src/http_client/failed_request_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class FailedRequestClient extends BaseClient {
queryString: query,
cookies: sendDefaultPii ? request.headers['Cookie'] : null,
data: _getDataFromRequest(request),
// ignore: deprecated_member_use_from_same_package
other: {
'content_length': request.contentLength.toString(),
'duration': requestDuration.toString(),
Expand Down
1 change: 1 addition & 0 deletions dart/lib/src/protocol.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export 'protocol/sentry_runtime.dart';
export 'protocol/sentry_stack_frame.dart';
export 'protocol/sentry_stack_trace.dart';
export 'protocol/sentry_user.dart';
export 'protocol/sentry_geo.dart';
export 'protocol/max_body_size.dart';
export 'protocol/sentry_culture.dart';
export 'protocol/sentry_thread.dart';
Expand Down
25 changes: 6 additions & 19 deletions dart/lib/src/protocol/breadcrumb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,27 +148,14 @@ class Breadcrumb {
/// Converts this breadcrumb to a map that can be serialized to JSON according
/// to the Sentry protocol.
Map<String, dynamic> toJson() {
final json = <String, dynamic>{
return {
'timestamp': formatDateAsIso8601WithMillisPrecision(timestamp),
if (message != null) 'message': message,
if (category != null) 'category': category,
if (data?.isNotEmpty ?? false) 'data': data,
if (level != null) 'level': level!.name,
if (type != null) 'type': type,
};

if (message != null) {
json['message'] = message;
}
if (category != null) {
json['category'] = category;
}
if (data?.isNotEmpty ?? false) {
json['data'] = data;
}
if (level != null) {
json['level'] = level!.name;
}

if (type != null) {
json['type'] = type;
}
return json;
}

Breadcrumb copyWith({
Expand Down
74 changes: 29 additions & 45 deletions dart/lib/src/protocol/debug_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ class DebugImage {
/// Optional. Identifier of the dynamic library or executable. It is the value of the LC_UUID load command in the Mach header, formatted as UUID. Can be empty for Mach images, as it is equivalent to the debug identifier.
final String? codeId;

/// MachO CPU subtype identifier.
final int? cpuSubtype;

/// MachO CPU type identifier.
final int? cpuType;

const DebugImage({
required this.type,
this.name,
Expand All @@ -57,6 +63,8 @@ class DebugImage {
this.codeFile,
this.arch,
this.codeId,
this.cpuType,
this.cpuSubtype,
});

/// Deserializes a [DebugImage] from JSON [Map].
Expand All @@ -73,56 +81,28 @@ class DebugImage {
codeFile: json['code_file'],
arch: json['arch'],
codeId: json['code_id'],
cpuType: json['cpu_type'],
cpuSubtype: json['cpu_subtype'],
);
}

/// Produces a [Map] that can be serialized to JSON.
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};

if (uuid != null) {
json['uuid'] = uuid;
}

json['type'] = type;

if (debugId != null) {
json['debug_id'] = debugId;
}

if (name != null) {
json['name'] = name;
}

if (debugFile != null) {
json['debug_file'] = debugFile;
}

if (codeFile != null) {
json['code_file'] = codeFile;
}

if (imageAddr != null) {
json['image_addr'] = imageAddr;
}

if (imageVmAddr != null) {
json['image_vmaddr'] = imageVmAddr;
}

if (imageSize != null) {
json['image_size'] = imageSize;
}

if (arch != null) {
json['arch'] = arch;
}

if (codeId != null) {
json['code_id'] = codeId;
}

return json;
return {
'type': type,
if (uuid != null) 'uuid': uuid,
if (debugId != null) 'debug_id': debugId,
if (name != null) 'name': name,
if (debugFile != null) 'debug_file': debugFile,
if (codeFile != null) 'code_file': codeFile,
if (imageAddr != null) 'image_addr': imageAddr,
if (imageVmAddr != null) 'image_vmaddr': imageVmAddr,
if (imageSize != null) 'image_size': imageSize,
if (arch != null) 'arch': arch,
if (codeId != null) 'code_id': codeId,
if (cpuType != null) 'cpu_type': cpuType,
if (cpuSubtype != null) 'cpu_subtype': cpuSubtype,
};
}

DebugImage copyWith({
Expand All @@ -137,6 +117,8 @@ class DebugImage {
int? imageSize,
String? arch,
String? codeId,
int? cpuType,
int? cpuSubtype,
}) =>
DebugImage(
uuid: uuid ?? this.uuid,
Expand All @@ -150,5 +132,7 @@ class DebugImage {
imageSize: imageSize ?? this.imageSize,
arch: arch ?? this.arch,
codeId: codeId ?? this.codeId,
cpuType: cpuType ?? this.cpuType,
cpuSubtype: cpuSubtype ?? this.cpuSubtype,
);
}
22 changes: 8 additions & 14 deletions dart/lib/src/protocol/debug_meta.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,15 @@ class DebugMeta {

/// Produces a [Map] that can be serialized to JSON.
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};

final sdkInfo = sdk?.toJson();
if (sdkInfo?.isNotEmpty ?? false) {
json['sdk_info'] = sdkInfo;
}

if (_images?.isNotEmpty ?? false) {
json['images'] = _images!
.map((e) => e.toJson())
.where((element) => element.isNotEmpty)
.toList(growable: false);
}

return json;
return {
if (sdkInfo?.isNotEmpty ?? false) 'sdk_info': sdkInfo,
if (_images?.isNotEmpty ?? false)
'images': _images!
.map((e) => e.toJson())
.where((element) => element.isNotEmpty)
.toList(growable: false)
};
}

DebugMeta copyWith({
Expand Down
38 changes: 9 additions & 29 deletions dart/lib/src/protocol/mechanism.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,34 +99,14 @@ class Mechanism {

/// Produces a [Map] that can be serialized to JSON.
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};

json['type'] = type;

if (description != null) {
json['description'] = description;
}

if (helpLink != null) {
json['help_link'] = helpLink;
}

if (handled != null) {
json['handled'] = handled;
}

if (_meta?.isNotEmpty ?? false) {
json['meta'] = _meta;
}

if (_data?.isNotEmpty ?? false) {
json['data'] = _data;
}

if (synthetic != null) {
json['synthetic'] = synthetic;
}

return json;
return {
'type': type,
if (description != null) 'description': description,
if (helpLink != null) 'help_link': helpLink,
if (handled != null) 'handled': handled,
if (_meta?.isNotEmpty ?? false) 'meta': _meta,
if (_data?.isNotEmpty ?? false) 'data': _data,
if (synthetic != null) 'synthetic': synthetic,
};
}
}
24 changes: 6 additions & 18 deletions dart/lib/src/protocol/sdk_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,12 @@ class SdkInfo {

/// Produces a [Map] that can be serialized to JSON.
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (sdkName != null) {
json['sdk_name'] = sdkName;
}

if (versionMajor != null) {
json['version_major'] = versionMajor;
}

if (versionMinor != null) {
json['version_minor'] = versionMinor;
}

if (versionPatchlevel != null) {
json['version_patchlevel'] = versionPatchlevel;
}

return json;
return {
if (sdkName != null) 'sdk_name': sdkName,
if (versionMajor != null) 'version_major': versionMajor,
if (versionMinor != null) 'version_minor': versionMinor,
if (versionPatchlevel != null) 'version_patchlevel': versionPatchlevel,
};
}

SdkInfo copyWith({
Expand Down
22 changes: 7 additions & 15 deletions dart/lib/src/protocol/sdk_version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,13 @@ class SdkVersion {

/// Produces a [Map] that can be serialized to JSON.
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};

json['name'] = name;

json['version'] = version;

if (packages.isNotEmpty) {
json['packages'] =
packages.map((p) => p.toJson()).toList(growable: false);
}

if (integrations.isNotEmpty) {
json['integrations'] = integrations;
}
return json;
return {
'name': name,
'version': version,
if (packages.isNotEmpty)
'packages': packages.map((p) => p.toJson()).toList(growable: false),
if (integrations.isNotEmpty) 'integrations': integrations,
};
}

/// Adds a package
Expand Down
Loading