Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
720b57b
Change transport api to envelope only
denrase Apr 19, 2021
3009e09
First step to fix tests by derializing from json
denrase Apr 20, 2021
6ae3cb9
Fix SentryDevice serialization/deserialization
denrase Apr 20, 2021
801da50
add tests for SentryGpu
denrase Apr 20, 2021
966018a
add sentryapp test
denrase Apr 20, 2021
b520915
add sentry browser test
denrase Apr 20, 2021
f994501
Add SentryOperatingSystem json tests
denrase Apr 20, 2021
cbb9813
Update sentry runtime test
denrase Apr 20, 2021
7e154d1
Add deserialize/serialize test to context test
denrase Apr 20, 2021
b60821b
Deserialize contexts in sentry event
denrase Apr 20, 2021
0300ebd
add json tests to sentry_request
denrase Apr 20, 2021
d9805a8
Test sdkinfo json
denrase Apr 20, 2021
178ea70
add DebugMeta decoding
denrase Apr 20, 2021
2a614d1
test sdk version and sentry package
denrase Apr 20, 2021
217f5ff
Add json tests for sentry_message
denrase Apr 20, 2021
7811216
test SentryStackFrame, remove duplicate key in toJson
denrase Apr 20, 2021
ace8e05
Add SentryStackTrace josn test
denrase Apr 20, 2021
3db2994
Merge test files and add todos for remaining json tests
denrase Apr 20, 2021
59b0eda
update todos
denrase Apr 20, 2021
aef3d68
implement breadcrumb test
denrase Apr 20, 2021
36eb8ec
Add mechanism json tests
denrase Apr 20, 2021
649f5aa
Implement SentryException test
denrase Apr 20, 2021
2872824
Add tests for SentryUser
denrase Apr 20, 2021
fbd80b5
Add json tests
denrase Apr 20, 2021
f15e269
sentry event fromjson
denrase Apr 20, 2021
37b1bc1
fix failing tests
denrase Apr 20, 2021
688468d
Run flutter format
denrase Apr 20, 2021
b1756a8
Remove not needed type casts
denrase Apr 26, 2021
51d132f
Document methods
denrase Apr 26, 2021
3ae6654
Use switch instead of ifs
denrase Apr 26, 2021
b1fbd1a
Update method documentation
denrase Apr 26, 2021
9d7c017
Add json access feedback
denrase Apr 26, 2021
49f0a59
Remove unused comment
denrase Apr 26, 2021
32c6a71
Assert stacktrace info
denrase Apr 26, 2021
e38c1cb
Restore type casts
denrase Apr 26, 2021
3a6b87d
Update formating
denrase Apr 26, 2021
9eb61c7
Dry extraction of Map<String, String>
denrase Apr 26, 2021
b031c51
Use dart:core cast<RK, RV>
denrase Apr 26, 2021
b21bfeb
Format sentry event
denrase Apr 26, 2021
231fde0
Merge branch 'feat/implement-envelope-based-transport' into feat/enve…
denrase May 3, 2021
c3a6895
Merge branch 'feat/implement-envelope-based-transport' into feat/enve…
denrase May 17, 2021
348bb15
format
denrase May 17, 2021
8519169
Add missing properties to clone method
denrase May 17, 2021
a2b5244
format
denrase May 17, 2021
42a9085
Merge branch 'feat/implement-envelope-based-transport' into feat/enve…
denrase May 18, 2021
aac65ab
Send bytes over bridge and implement android side
denrase May 18, 2021
eeafe75
Deserialize envelope in native ios/macos bridge
denrase May 18, 2021
0fbc8fc
Update test to native bridge
denrase May 18, 2021
bffc2ef
Add test for binary envelope
denrase May 18, 2021
6f77ca0
Only run test with dart.io import on vm target, add changelog
denrase May 21, 2021
b9b0127
Use obj-c dynamism to access private api while we don't have public o…
denrase May 21, 2021
c52fcf7
Merge branch 'feat/implement-envelope-based-transport' into feat/enve…
denrase May 21, 2021
9d995b6
Merge branch 'feat/implement-envelope-based-transport' into feat/enve…
denrase May 21, 2021
17374bb
Merge branch 'feat/implement-envelope-based-transport' into feat/enve…
denrase May 21, 2021
6edd28e
Merge branch 'feat/implement-envelope-based-transport' into feat/enve…
denrase May 25, 2021
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased

* Feature: Envelope Only Transport API #426 (#463)

# 5.1.0-beta.1

* Fix: `Sentry.close()` closes native SDK integrations (#388)
Expand All @@ -25,7 +27,7 @@
## Breaking Changes:

* Feat: Support envelope based transport for events (#391)
* The method signature of `Transport` changed from `Future<SentryId> send(SentryEvent event)` to `Future<SentryId> sendSentryEvent(SentryEvent event)`
* The method signature of `Transport` changed from `Future<SentryId> send(SentryEvent event)` to `Future<SentryId> send(SentryEnvelope envelope)`

## Sentry Self Hosted Compatibility

Expand Down
14 changes: 14 additions & 0 deletions dart/lib/src/protocol/breadcrumb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@ class Breadcrumb {
/// The value is submitted to Sentry with second precision.
final DateTime timestamp;

/// Deserializes a [Breadcrumb] from JSON [Map].
factory Breadcrumb.fromJson(Map<String, dynamic> json) {
final levelName = json['level'];
final timestamp = json['timestamp'];
return Breadcrumb(
timestamp: timestamp != null ? DateTime.tryParse(timestamp) : null,
message: json['message'],
category: json['category'],
data: json['data'],
level: levelName != null ? SentryLevel.fromName(levelName) : null,
type: json['type'],
);
}

/// Converts this breadcrumb to a map that can be serialized to JSON according
/// to the Sentry protocol.
Map<String, dynamic> toJson() {
Expand Down
1 change: 1 addition & 0 deletions dart/lib/src/protocol/contexts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Contexts extends MapView<String, dynamic> {
SentryGpu.type: gpu,
});

/// Deserializes [Contexts] from JSON [Map].
factory Contexts.fromJson(Map<String, dynamic> data) {
final contexts = Contexts(
device: data[SentryDevice.type] != null
Expand Down
16 changes: 16 additions & 0 deletions dart/lib/src/protocol/debug_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ class DebugImage {
this.codeId,
});

/// Deserializes a [DebugImage] from JSON [Map].
factory DebugImage.fromJson(Map<String, dynamic> json) {
return DebugImage(
type: json['type'],
imageAddr: json['image_addr'],
debugId: json['debug_id'],
debugFile: json['debug_file'],
imageSize: json['image_size'],
uuid: json['uuid'],
codeFile: json['code_file'],
arch: json['arch'],
codeId: json['code_id'],
);
}

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

Expand Down
14 changes: 14 additions & 0 deletions dart/lib/src/protocol/debug_meta.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ class DebugMeta {

DebugMeta({this.sdk, List<DebugImage>? images}) : _images = images;

/// Deserializes a [DebugMeta] from JSON [Map].
factory DebugMeta.fromJson(Map<String, dynamic> json) {
final sdkInfoJson = json['sdk_info'];
final debugImagesJson = json['images'] as List<dynamic>?;
return DebugMeta(
sdk: sdkInfoJson != null ? SdkInfo.fromJson(sdkInfoJson) : null,
images: debugImagesJson
?.map((debugImageJson) =>
DebugImage.fromJson(debugImageJson as Map<String, dynamic>))
.toList(),
);
}

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

Expand Down
14 changes: 14 additions & 0 deletions dart/lib/src/protocol/mechanism.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ class Mechanism {
synthetic: synthetic ?? this.synthetic,
);

/// Deserializes a [Mechanism] from JSON [Map].
factory Mechanism.fromJson(Map<String, dynamic> json) {
return Mechanism(
type: json['type'],
description: json['description'],
helpLink: json['help_link'],
handled: json['handled'],
meta: json['meta'],
data: json['data'],
synthetic: json['synthetic'],
);
}

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

Expand Down
11 changes: 11 additions & 0 deletions dart/lib/src/protocol/sdk_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ class SdkInfo {
this.versionPatchlevel,
});

/// Deserializes a [SdkInfo] from JSON [Map].
factory SdkInfo.fromJson(Map<String, dynamic> json) {
return SdkInfo(
sdkName: json['sdk_name'],
versionMajor: json['version_major'],
versionMinor: json['version_minor'],
versionPatchlevel: json['version_patchlevel'],
);
}

/// Produces a [Map] that can be serialized to JSON.
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (sdkName != null) {
Expand Down
14 changes: 14 additions & 0 deletions dart/lib/src/protocol/sdk_version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ class SdkVersion {

String get identifier => '$name/$version';

/// Deserializes a [SdkVersion] from JSON [Map].
factory SdkVersion.fromJson(Map<String, dynamic> json) {
final packagesJson = json['packages'] as List<dynamic>?;
final integrationsJson = json['integrations'] as List<dynamic>?;
return SdkVersion(
name: json['name'],
version: json['version'],
packages: packagesJson
?.map((e) => SentryPackage.fromJson(e as Map<String, dynamic>))
.toList(),
integrations: integrationsJson?.map((e) => e as String).toList(),
);
}

/// Produces a [Map] that can be serialized to JSON.
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
Expand Down
25 changes: 13 additions & 12 deletions dart/lib/src/protocol/sentry_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@ class SentryApp {
this.deviceAppHash,
});

factory SentryApp.fromJson(Map<String, dynamic> data) => SentryApp(
name: data['app_name'],
version: data['app_version'],
identifier: data['app_identifier'],
build: data['app_build'],
buildType: data['build_type'],
startTime: data['app_start_time'] != null
? DateTime.tryParse(data['app_start_time'])
: null,
deviceAppHash: data['device_app_hash'],
);

/// Human readable application name, as it appears on the platform.
final String? name;

Expand All @@ -51,6 +39,19 @@ class SentryApp {
/// Application specific device identifier.
final String? deviceAppHash;

/// Deserializes a [SentryApp] from JSON [Map].
factory SentryApp.fromJson(Map<String, dynamic> data) => SentryApp(
name: data['app_name'],
version: data['app_version'],
identifier: data['app_identifier'],
build: data['app_build'],
buildType: data['build_type'],
startTime: data['app_start_time'] != null
? DateTime.tryParse(data['app_start_time'])
: null,
deviceAppHash: data['device_app_hash'],
);

/// Produces a [Map] that can be serialized to JSON.
Map<String, dynamic> toJson() {
final json = <String, String>{};
Expand Down
11 changes: 6 additions & 5 deletions dart/lib/src/protocol/sentry_browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ class SentryBrowser {
/// Creates an instance of [SentryBrowser].
const SentryBrowser({this.name, this.version});

factory SentryBrowser.fromJson(Map<String, dynamic> data) => SentryBrowser(
name: data['name'],
version: data['version'],
);

/// Human readable application name, as it appears on the platform.
final String? name;

/// Human readable application version, as it appears on the platform.
final String? version;

/// Deserializes a [SentryBrowser] from JSON [Map].
factory SentryBrowser.fromJson(Map<String, dynamic> data) => SentryBrowser(
name: data['name'],
version: data['version'],
);

/// Produces a [Map] that can be serialized to JSON.
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
Expand Down
125 changes: 66 additions & 59 deletions dart/lib/src/protocol/sentry_device.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,39 +41,6 @@ class SentryDevice {
batteryLevel == null || (batteryLevel >= 0 && batteryLevel <= 100),
);

factory SentryDevice.fromJson(Map<String, dynamic> data) => SentryDevice(
name: data['name'],
family: data['family'],
model: data['model'],
modelId: data['model_id'],
arch: data['arch'],
batteryLevel: data['battery_level'],
orientation: data['orientation'],
manufacturer: data['manufacturer'],
brand: data['brand'],
screenResolution: data['screen_resolution'],
screenHeightPixels: data['screen_height_pixels'],
screenWidthPixels: data['screen_width_pixels'],
screenDensity: data['screen_density'],
screenDpi: data['screen_dpi'],
online: data['online'],
charging: data['charging'],
lowMemory: data['low_memory'],
simulator: data['simulator'],
memorySize: data['memory_size'],
freeMemory: data['free_memory'],
usableMemory: data['usable_memory'],
storageSize: data['storage_size'],
freeStorage: data['free_storage'],
externalStorageSize: data['external_storage_size'],
externalFreeStorage: data['external_free_storage'],
bootTime: data['boot_time'] != null
? DateTime.tryParse(data['boot_time'])
: null,
timezone: data['timezone'],
language: data['language'],
);

/// The name of the device. This is typically a hostname.
final String? name;

Expand Down Expand Up @@ -165,6 +132,44 @@ class SentryDevice {
/// The language of the device, e.g.: `en_US`.
final String? language;

/// Deserializes a [SentryDevice] from JSON [Map].
factory SentryDevice.fromJson(Map<String, dynamic> data) => SentryDevice(
name: data['name'],
family: data['family'],
model: data['model'],
modelId: data['model_id'],
arch: data['arch'],
batteryLevel: data['battery_level'],
orientation: data['orientation'] == 'portrait'
? SentryOrientation.portrait
: data['orientation'] == 'landscape'
? SentryOrientation.landscape
: null,
manufacturer: data['manufacturer'],
brand: data['brand'],
screenResolution: data['screen_resolution'],
screenHeightPixels: data['screen_height_pixels'],
screenWidthPixels: data['screen_width_pixels'],
screenDensity: data['screen_density'],
screenDpi: data['screen_dpi'],
online: data['online'],
charging: data['charging'],
lowMemory: data['low_memory'],
simulator: data['simulator'],
memorySize: data['memory_size'],
freeMemory: data['free_memory'],
usableMemory: data['usable_memory'],
storageSize: data['storage_size'],
freeStorage: data['free_storage'],
externalStorageSize: data['external_storage_size'],
externalFreeStorage: data['external_free_storage'],
bootTime: data['boot_time'] != null
? DateTime.tryParse(data['boot_time'])
: null,
timezone: data['timezone'],
language: data['language'],
);

/// Produces a [Map] that can be serialized to JSON.
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
Expand Down Expand Up @@ -299,32 +304,34 @@ class SentryDevice {
}

SentryDevice clone() => SentryDevice(
name: name,
family: family,
model: model,
modelId: modelId,
arch: arch,
batteryLevel: batteryLevel,
orientation: orientation,
manufacturer: manufacturer,
brand: brand,
screenResolution: screenResolution,
screenDensity: screenDensity,
screenDpi: screenDpi,
online: online,
charging: charging,
lowMemory: lowMemory,
simulator: simulator,
memorySize: memorySize,
freeMemory: freeMemory,
usableMemory: usableMemory,
storageSize: storageSize,
freeStorage: freeStorage,
externalStorageSize: externalStorageSize,
externalFreeStorage: externalFreeStorage,
bootTime: bootTime,
timezone: timezone,
);
name: name,
family: family,
model: model,
modelId: modelId,
arch: arch,
batteryLevel: batteryLevel,
orientation: orientation,
manufacturer: manufacturer,
brand: brand,
screenResolution: screenResolution,
screenHeightPixels: screenHeightPixels,
screenWidthPixels: screenWidthPixels,
screenDensity: screenDensity,
screenDpi: screenDpi,
online: online,
charging: charging,
lowMemory: lowMemory,
simulator: simulator,
memorySize: memorySize,
freeMemory: freeMemory,
usableMemory: usableMemory,
storageSize: storageSize,
freeStorage: freeStorage,
externalStorageSize: externalStorageSize,
externalFreeStorage: externalFreeStorage,
bootTime: bootTime,
timezone: timezone,
language: language);

SentryDevice copyWith({
String? name,
Expand Down
Loading