Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
163cce7
Merge branch 'main' into feature/unified-api
marandaneto Oct 14, 2020
b91c954
Merge branch 'main' into feature/unified-api
marandaneto Oct 14, 2020
5018978
feat : static SDK main entry withSentry.init(options),... (#108)
rxlabz Oct 14, 2020
d577e35
Feat : add a Hub class (#113)
rxlabz Oct 19, 2020
fabf56f
feat: sentry options (#116)
marandaneto Oct 20, 2020
2b36bec
ref: Hub passes the Scope (#114)
marandaneto Oct 20, 2020
af3ecc0
Refacto : initialize SentryClient with SentryOptions (#118)
rxlabz Oct 20, 2020
19f5592
ref: SentryId generates UUID (#119)
marandaneto Oct 21, 2020
b51b0da
ref: Event now is SentryEvent and added GPU (#121)
marandaneto Oct 22, 2020
3fa0b79
feat: before breadcrumb and scope ref (#122)
marandaneto Oct 22, 2020
2cc1d78
Ref: Hint is passed across Sentry static class, Hub and Client (#124)
marandaneto Oct 22, 2020
11b821b
Ref: Remove stackFrameFilter in favor of beforeSendCallback (#125)
marandaneto Oct 22, 2020
ee737a2
Ref: Sentry init with null and empty DSN and close method (#126)
marandaneto Oct 22, 2020
eab4ccf
Refacto : add a Transport class (#123)
rxlabz Oct 23, 2020
c301ec6
Ref: execute before send callback (#128)
marandaneto Oct 24, 2020
1794f04
feat: addBreadcrumb to the Sentry static API (#133)
marandaneto Oct 26, 2020
e7db5d1
Feat: add lastEventId to the Sentry static API (#134)
marandaneto Oct 26, 2020
dc962ae
Fix: Breadcrumb data should accept serializable types and not only St…
marandaneto Oct 26, 2020
b9cd68b
Fix: NoOp encode for Web (#138)
marandaneto Oct 26, 2020
7b81890
Fix: execute Integrations on Hub creation (#136)
marandaneto Oct 26, 2020
b1761f4
unified api fixes and add web example (#137)
rxlabz Oct 27, 2020
d249c97
Ref/prepare event & scope.applyToEvent (#140)
rxlabz Oct 27, 2020
dc258d9
Ref : rename files accordely to their content (#141)
rxlabz Oct 27, 2020
c6669c3
rename the `throwable` argument to `exception` (#142)
rxlabz Oct 27, 2020
a0bb939
lint : prefer relative imports and show error when a @required argume…
rxlabz Oct 27, 2020
a7ca364
fix: Unified API code review (#144)
marandaneto Oct 28, 2020
56ac62a
Ref : remove dsn from Transport public API (#145)
rxlabz Oct 28, 2020
209f18a
Fix the pubspecs SDK constraints (#146)
rxlabz Oct 28, 2020
108ac6c
fix : throws on invalid dsn (#148)
rxlabz Oct 28, 2020
a81da3e
add comment to change the DSN
marandaneto Oct 28, 2020
c1812b7
update the workflow to run both on vm and on browser (#150)
rxlabz Oct 28, 2020
f597604
Bump sentry sdk to 4.0.0-alpha.1 (#151)
marandaneto Oct 28, 2020
6d9caff
remove TODOs
marandaneto Oct 28, 2020
32debd7
fix the web example pubspec (#153)
rxlabz Oct 28, 2020
c80365f
Ref: remove platform specific clients to use SentryClient (#152)
rxlabz Oct 29, 2020
2ed0f92
fix conflict
marandaneto Oct 29, 2020
c3ab59f
rewrite changelog
marandaneto Oct 29, 2020
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
Prev Previous commit
Next Next commit
Ref: remove platform specific clients to use SentryClient (#152)
  • Loading branch information
rxlabz authored Oct 29, 2020
commit c80365f473a018e36504b2d09d5721b8dc2ebc72
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
- update the Dart sdk constraint
- fix : throws on invalid dsn
- GH Action ( CI ) run test on vm and on browser
- ref: remove SentryBrowserClient & SentryIOClient, all platform can use SentryClient
- fix: example_web pubspec

# `package:sentry` changelog
Expand Down
6 changes: 0 additions & 6 deletions dart/lib/browser.dart

This file was deleted.

6 changes: 0 additions & 6 deletions dart/lib/io.dart

This file was deleted.

32 changes: 0 additions & 32 deletions dart/lib/src/sentry_browser_client.dart

This file was deleted.

18 changes: 5 additions & 13 deletions dart/lib/src/sentry_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,22 @@ import 'dart:math';

import 'protocol.dart';
import 'scope.dart';
import 'sentry_client_stub.dart'
if (dart.library.html) 'sentry_browser_client.dart'
if (dart.library.io) 'sentry_io_client.dart';
import 'sentry_options.dart';
import 'transport/http_transport.dart';
import 'transport/noop_transport.dart';
import 'version.dart';

/// Logs crash reports and events to the Sentry.io service.
abstract class SentryClient {
/// Creates a new platform appropriate client.
///
/// Creates an `SentryIOClient` if `dart:io` is available and a `SentryBrowserClient` if
/// `dart:html` is available, otherwise it will throw an unsupported error.
factory SentryClient(SentryOptions options) => createSentryClient(options);

SentryClient.base(this._options, {String origin}) {
class SentryClient {
/// Instantiates a client using [SentryOptions]
SentryClient(SentryOptions options) : _options = options {
_random = _options.sampleRate == null ? null : Random();
if (_options.transport is NoOpTransport) {
_options.transport = HttpTransport(options: _options, origin: origin);
_options.transport = HttpTransport(options: _options);
}
}

SentryOptions _options;
final SentryOptions _options;

Random _random;

Expand Down
18 changes: 0 additions & 18 deletions dart/lib/src/sentry_io_client.dart

This file was deleted.

9 changes: 3 additions & 6 deletions dart/lib/src/transport/http_transport.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import '../protocol.dart';
import '../sentry_options.dart';
import '../utils.dart';
import 'noop_encode.dart' if (dart.library.io) 'encode.dart';
import 'noop_origin.dart' if (dart.library.html) 'origin.dart';
import 'transport.dart';

/// A transport is in charge of sending the event to the Sentry server.
Expand All @@ -15,16 +16,12 @@ class HttpTransport implements Transport {

final Dsn _dsn;

/// Use for browser stacktrace
final String _origin;

CredentialBuilder _credentialBuilder;

final Map<String, String> _headers;

HttpTransport({@required SentryOptions options, String origin})
HttpTransport({@required SentryOptions options})
: _options = options,
_origin = origin,
_dsn = Dsn.parse(options.dsn),
_headers = _buildHeaders(sdkIdentifier: options.sdk.identifier) {
_credentialBuilder = CredentialBuilder(
Expand All @@ -36,7 +33,7 @@ class HttpTransport implements Transport {

@override
Future<SentryId> send(SentryEvent event) async {
final data = event.toJson(origin: _origin);
final data = event.toJson(origin: eventOrigin);

final body = _bodyEncoder(
data,
Expand Down
1 change: 1 addition & 0 deletions dart/lib/src/transport/noop_origin.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
String eventOrigin;
3 changes: 3 additions & 0 deletions dart/lib/src/transport/origin.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import 'dart:html';

String get eventOrigin => '${window.location.origin}/';
11 changes: 1 addition & 10 deletions dart/test/sentry_browser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@TestOn('browser')
import 'package:sentry/browser.dart';
import 'package:sentry/sentry.dart';
import 'package:test/test.dart';

import 'test_utils.dart';

void main() {
group('SentryBrowserClient', () {
test('SentryClient constructor build browser client', () {
final client = SentryClient(SentryOptions(dsn: testDsn));
expect(client is SentryBrowserClient, isTrue);
});

runTest(isWeb: true);
});
runTest(isWeb: true);
}
11 changes: 1 addition & 10 deletions dart/test/sentry_io_client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,10 @@
@TestOn('vm')
import 'dart:io';

import 'package:sentry/sentry.dart';
import 'package:sentry/src/sentry_io_client.dart';
import 'package:test/test.dart';

import 'test_utils.dart';

void main() {
group(SentryIOClient, () {
test('SentryClient constructor build io client', () {
final client = SentryClient(SentryOptions(dsn: testDsn));
expect(client is SentryIOClient, isTrue);
});

runTest(gzip: gzip);
});
runTest(gzip: gzip);
}