Skip to content

Implement envelope based transport #391

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

Merged
merged 95 commits into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
74d47e7
Add empty classes for envelopes
denrase Mar 26, 2021
8e770aa
Add properties
denrase Mar 26, 2021
737c6f8
Create envelope classes from event
denrase Mar 26, 2021
c0e4b68
introduce serialize method
denrase Mar 26, 2021
70150b2
Serialize SentryEnvelopeItemHeader
denrase Mar 26, 2021
446e04a
Implement serialize of SentryEnvelopeItem
denrase Mar 26, 2021
f8a839e
Implement serialize and fromEvent for SentryEnvelopeItem
denrase Mar 26, 2021
13826d5
Implement serialize of SentryEnvelopeItemHeader
denrase Mar 26, 2021
42b6072
Implement SentryEnvelope
denrase Mar 26, 2021
c99aa8c
Add rste limit category
denrase Mar 26, 2021
47a01d7
add empty rate limiter
denrase Mar 26, 2021
0831a4c
Add empty tests for rate limiter
denrase Mar 26, 2021
d9752d3
parse rate limit header
denrase Mar 26, 2021
e60c8d4
Implement RateLimitParser
denrase Mar 26, 2021
5136095
Move out decision what to parse
denrase Mar 26, 2021
2c44b15
Own class for RateLimitParser, return map instead of list of RateLimi…
denrase Mar 29, 2021
a34e1c3
Port java rate limiter tests
denrase Mar 29, 2021
ab88d44
implement rate limiter, fix rate limit parser
denrase Mar 29, 2021
36efe03
Support multiple rate limits for same category
denrase Mar 29, 2021
94d4b8a
Merge branch 'main' into feat/implement-envelope-based-transport
denrase Mar 29, 2021
c6d3b35
No generated mock for cdtp
denrase Mar 29, 2021
53e31b3
Use envelope endpoint
denrase Apr 6, 2021
1bf198b
Handle envelope data in test
denrase Apr 6, 2021
f4a97be
Fallback to empty
denrase Apr 6, 2021
7c2529e
update retry after limits
denrase Apr 6, 2021
e35c4c8
test ratelimiter integration into http_transport
denrase Apr 6, 2021
d1547fa
Use clock from options
denrase Apr 6, 2021
c100376
No need to test system code
denrase Apr 6, 2021
1c7c69c
Update comments, Add test for envelope capture
denrase Apr 6, 2021
a3c5a42
Merge branch 'main' into feat/implement-envelope-based-transport
denrase Apr 6, 2021
20d1e82
Delete unues file, comment in tests
denrase Apr 6, 2021
650b907
format code
denrase Apr 6, 2021
9acd08e
update changelog
denrase Apr 6, 2021
1f177a4
Defer serialization, Serialize to bytes
denrase Apr 7, 2021
e4dc045
Use factory instead of static
denrase Apr 7, 2021
103bf08
Remove todo
denrase Apr 7, 2021
9e13272
Remove unused main function
denrase Apr 7, 2021
07642d3
Use local variable for dart type inference to kick in
denrase Apr 7, 2021
5f7d42c
send correct header for envelope data
denrase Apr 7, 2021
c8c499a
Change const name to dart style
denrase Apr 7, 2021
c18c442
Leave in file system transport
denrase Apr 7, 2021
30754b8
Remove debug code
denrase Apr 7, 2021
424b5de
Use forEach instead of for loops
denrase Apr 7, 2021
c921734
Use variable instead of list access again
denrase Apr 7, 2021
f753638
Run format
denrase Apr 7, 2021
4d5dcc5
Update envelope class serielaization method naming and return types
denrase Apr 7, 2021
d24dc78
Introduce breaking changes section
denrase Apr 8, 2021
d93eddc
Add what has changed
denrase Apr 8, 2021
0bb9a59
Return non-null sentryid from transport calls
denrase Apr 8, 2021
7697bef
Use trailing comma
denrase Apr 8, 2021
0cd0455
Run format
denrase Apr 8, 2021
ef3fb62
Add documentation
denrase Apr 8, 2021
5fe2f13
Make prop final
denrase Apr 8, 2021
c8ede69
Add self-hosted info
denrase Apr 8, 2021
e3c28d8
Use correct package name
denrase Apr 8, 2021
27611aa
Use `StreamedRequest` to send data
denrase Apr 8, 2021
04d444e
Change toEnvelopeItem to stream
denrase Apr 8, 2021
9dcfb5c
Change envelope item to stream
denrase Apr 8, 2021
2b47068
Use temp variable to enable comipler non-null check
denrase Apr 8, 2021
94c2099
Add doc for captureEnvelope
denrase Apr 8, 2021
39e26e3
REmove commented out import
denrase Apr 8, 2021
cc5862c
Remove unused import
denrase Apr 8, 2021
890a50d
Update changelog
denrase Apr 13, 2021
1df4c67
Use chunked conversion for gzip envelopes
denrase Apr 13, 2021
67a41c4
Remove unused import
denrase Apr 13, 2021
0600bd7
Use Duration tyoe instead of int
denrase Apr 13, 2021
78d78e6
Move compression in sink to encode.dart and noop_encode.dart
denrase Apr 13, 2021
0871190
Merge branch 'main' into feat/implement-envelope-based-transport
denrase Apr 19, 2021
950ff4a
Use string types in item headers
denrase Apr 19, 2021
085b58c
Merge branch 'main' into feat/implement-envelope-based-transport
denrase Apr 30, 2021
02c1979
Merge branch 'main' into feat/implement-envelope-based-transport
denrase May 17, 2021
009138c
Use for loops and contunie early
denrase May 17, 2021
c6c1fbf
Use isAfter method on date
denrase May 17, 2021
215ce24
Use isAfter date method
denrase May 17, 2021
996f976
Fix typo
denrase May 17, 2021
40a3cc2
no need to temp variable
denrase May 17, 2021
ecc68cf
format
denrase May 17, 2021
cdc5e18
Fix path in comments
denrase May 17, 2021
b46d57b
Merge branch 'main' into feat/implement-envelope-based-transport
denrase May 17, 2021
683d7b2
Merge branch 'main' into feat/implement-envelope-based-transport
denrase May 21, 2021
e37bf31
Remove commented out code
denrase May 21, 2021
00ee4bf
format
denrase May 21, 2021
d01bb25
Use fixture pattern
denrase May 21, 2021
2e204d4
Run format
denrase May 25, 2021
f9a4bae
Envelope Only Transport API (#426)
denrase May 26, 2021
739fe04
Move new changelog items to unrealeased section
denrase May 28, 2021
60cde6d
Bump sentry-cocoa version to 7.1.3, Use PrivateSentrySDKOnly.envelope…
denrase May 28, 2021
b6c7485
Merge branch 'main' into feat/implement-envelope-based-transport
denrase May 31, 2021
7650f82
Update changelog
denrase May 31, 2021
e8dc883
Merge branch 'main' into feat/implement-envelope-based-transport
denrase Jun 8, 2021
32fc143
Merge remote-tracking branch 'origin/main' into feat/implement-envelo…
ueman Jun 8, 2021
3e90935
Merge branch 'main' into feat/implement-envelope-based-transport
denrase Jun 8, 2021
fbfc409
Update changelog
denrase Jun 8, 2021
ba66eb4
Merge branch 'feat/implement-envelope-based-transport' of https://git…
denrase Jun 8, 2021
99af50a
Fix klint issue
denrase Jun 8, 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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Unreleased

* Feat: Add Culture Context (#491)

## 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> send(SentryEnvelope envelope)`
* Remove `Sentry.currentHub` (#490)

# 5.1.0
Expand Down Expand Up @@ -32,6 +37,10 @@
* Feature: Add `withScope` callback to capture methods (#463)
* Fix: Add missing properties `language`, `screenHeightPixels` and `screenWidthPixels` to `SentryDevice` (#465)

## Sentry Self Hosted Compatibility

* This version of the `sentry` Dart package requires [Sentry server >= v20.6.0](https://github.com/getsentry/onpremise/releases). This only applies to on-premise Sentry, if you are using sentry.io no action is needed.

# 5.0.0

* Sound null safety
Expand Down
1 change: 1 addition & 0 deletions dart/lib/sentry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export 'src/noop_isolate_error_integration.dart'
export 'src/protocol.dart';
export 'src/scope.dart';
export 'src/sentry.dart';
export 'src/sentry_envelope.dart';
export 'src/sentry_client.dart';
export 'src/sentry_options.dart';
// useful for integrations
Expand Down
5 changes: 5 additions & 0 deletions dart/lib/src/noop_sentry_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:async';
import 'protocol.dart';
import 'scope.dart';
import 'sentry_client.dart';
import 'sentry_envelope.dart';

class NoOpSentryClient implements SentryClient {
NoOpSentryClient._();
Expand Down Expand Up @@ -42,6 +43,10 @@ class NoOpSentryClient implements SentryClient {
}) =>
Future.value(SentryId.empty());

@override
Future<SentryId> captureEnvelope(SentryEnvelope envelope) =>
Future.value(SentryId.empty());

@override
Future<void> close() async {
return;
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 @@ -27,6 +27,7 @@ class Contexts extends MapView<String, dynamic> {
SentryCulture.type: culture,
});

/// 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
2 changes: 1 addition & 1 deletion dart/lib/src/protocol/dsn.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Dsn {
apiPath = 'api';
}
return Uri.parse(
'${uriCopy.scheme}://${uriCopy.host}$port/$apiPath/$projectId/store/',
'${uriCopy.scheme}://${uriCopy.host}$port/$apiPath/$projectId/envelope/',
);
}

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
Loading