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 : rename files accordely to their content (#141)
  • Loading branch information
rxlabz authored Oct 27, 2020
commit dc258d9a0e287d8e7342796c895a9b482843d544
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
- Fix: NoOp encode for Web
- Fix: Breadcrumb data should accept serializable types and not only String values
- Ref: added Scope.applyToEvent
- Ref: rename sdk files accordely to their content

# `package:sentry` changelog

Expand Down
2 changes: 1 addition & 1 deletion dart/example/event_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ final event = SentryEvent(
tags: const <String, String>{'project-id': '7371'},
extra: const <String, String>{'section': '1'},
fingerprint: const <String>['example-dart'],
userContext: const User(
user: const User(
id: '800',
username: 'first-user',
email: '[email protected]',
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 @@ -9,7 +9,7 @@ final event = SentryEvent(
tags: const <String, String>{'project-id': '7371'},
extra: const <String, String>{'section': '1'},
fingerprint: const <String>['example-dart'],
userContext: const User(
user: const User(
id: '800',
username: 'first-user',
email: '[email protected]',
Expand Down
2 changes: 1 addition & 1 deletion dart/lib/browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

export 'src/browser_client.dart';
export 'src/sentry_browser_client.dart';
export 'src/version.dart';
2 changes: 1 addition & 1 deletion dart/lib/io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

export 'src/io_client.dart';
export 'src/sentry_io_client.dart';
export 'src/version.dart';
2 changes: 1 addition & 1 deletion dart/lib/sentry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
// found in the LICENSE file.

/// A pure Dart client for Sentry.io crash reporting.
export 'src/client.dart';
export 'src/protocol.dart';
export 'src/scope.dart';
export 'src/sentry.dart';
export 'src/sentry_client.dart';
export 'src/sentry_options.dart';
export 'src/transport/transport.dart';
export 'src/version.dart';
2 changes: 1 addition & 1 deletion dart/lib/src/hub.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import 'dart:collection';

import 'package:sentry/src/hub_adapter.dart';

import 'client.dart';
import 'noop_client.dart';
import 'protocol.dart';
import 'scope.dart';
import 'sentry_client.dart';
import 'sentry_options.dart';

typedef ScopeCallback = void Function(Scope);
Expand Down
12 changes: 7 additions & 5 deletions dart/lib/src/hub_adapter.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import 'package:sentry/src/protocol/sentry_level.dart';
import 'package:sentry/src/protocol/sentry_id.dart';
import 'package:sentry/src/protocol/sentry_event.dart';
import 'dart:async';

import 'package:sentry/src/protocol/breadcrumb.dart';
import 'package:sentry/src/client.dart';
import 'package:sentry/src/protocol/sentry_event.dart';
import 'package:sentry/src/protocol/sentry_id.dart';
import 'package:sentry/src/protocol/sentry_level.dart';
import 'package:sentry/src/sentry.dart';
import 'package:sentry/src/sentry_client.dart';

import 'hub.dart';
import 'dart:async';

/// Hub adapter to make Integrations testable
class HubAdapter implements Hub {
Expand Down
2 changes: 1 addition & 1 deletion dart/lib/src/noop_client.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'dart:async';

import 'client.dart';
import 'protocol.dart';
import 'scope.dart';
import 'sentry_client.dart';

class NoOpSentryClient implements SentryClient {
NoOpSentryClient._();
Expand Down
4 changes: 2 additions & 2 deletions dart/lib/src/noop_hub.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import 'dart:async';

import 'package:sentry/src/protocol/breadcrumb.dart';

import 'client.dart';
import 'hub.dart';
import 'protocol/sentry_event.dart';
import 'protocol/sentry_level.dart';
import 'protocol/sentry_id.dart';
import 'protocol/sentry_level.dart';
import 'sentry_client.dart';

class NoOpHub implements Hub {
NoOpHub._();
Expand Down
17 changes: 8 additions & 9 deletions dart/lib/src/protocol/sentry_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SentryEvent {
this.tags,
this.extra,
this.fingerprint,
this.userContext,
this.user,
this.contexts,
this.breadcrumbs,
}) : eventId = eventId ?? SentryId.newId(),
Expand Down Expand Up @@ -112,8 +112,8 @@ class SentryEvent {
/// Information about the current user.
///
/// The value in this field overrides the user context
/// set in [SentryClient.userContext] for this logged event.
final User userContext;
/// set in [SentryClient.user] for this logged event.
final User user;

/// The context interfaces provide additional context data.
/// Typically this is data related to the current user,
Expand Down Expand Up @@ -161,7 +161,7 @@ class SentryEvent {
Map<String, String> tags,
Map<String, dynamic> extra,
List<String> fingerprint,
User userContext,
User user,
Contexts contexts,
List<Breadcrumb> breadcrumbs,
Sdk sdk,
Expand All @@ -185,7 +185,7 @@ class SentryEvent {
tags: tags ?? this.tags,
extra: extra ?? this.extra,
fingerprint: fingerprint ?? this.fingerprint,
userContext: userContext ?? this.userContext,
user: user ?? this.user,
contexts: contexts ?? this.contexts,
breadcrumbs: breadcrumbs ?? this.breadcrumbs,
sdk: sdk ?? this.sdk,
Expand Down Expand Up @@ -288,10 +288,9 @@ class SentryEvent {
json['contexts'] = contextsMap;
}

Map<String, dynamic> userContextMap;
if (userContext != null &&
(userContextMap = userContext.toJson()).isNotEmpty) {
json['user'] = userContextMap;
Map<String, dynamic> userMap;
if (user != null && (userMap = user.toJson()).isNotEmpty) {
json['user'] = userMap;
}

if (fingerprint != null && fingerprint.isNotEmpty) {
Expand Down
4 changes: 2 additions & 2 deletions dart/lib/src/protocol/user.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/// Describes the current user associated with the application, such as the
/// currently signed in user.
///
/// The user can be specified globally in the [SentryClient.userContext] field,
/// or per event in the [Event.userContext] field.
/// The user can be specified globally in the [SentryClient.user] field,
/// or per event in the [Event.user] field.
///
/// You should provide at least either an [id] (a unique identifier for an
/// authenticated user) or [ipAddress] (their IP address).
Expand Down
2 changes: 1 addition & 1 deletion dart/lib/src/scope.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class Scope {
SentryEvent applyToEvent(SentryEvent event, dynamic hint) {
event = event.copyWith(
transaction: event.transaction ?? transaction,
userContext: event.userContext ?? user,
user: event.user ?? user,
fingerprint: event.fingerprint ?? fingerprint,
breadcrumbs: event.breadcrumbs ?? breadcrumbs,
tags: tags.isNotEmpty ? _mergeEventTags(event) : event.tags,
Expand Down
2 changes: 1 addition & 1 deletion dart/lib/src/sentry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import 'dart:async';

import 'package:meta/meta.dart';

import 'client.dart';
import 'hub.dart';
import 'noop_hub.dart';
import 'protocol.dart';
import 'sentry_client.dart';
import 'sentry_options.dart';

/// Configuration options callback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
/// A pure Dart client for Sentry.io crash reporting.
import 'dart:html' show window;

import 'client.dart';
import 'protocol.dart';
import 'sentry_client.dart';
import 'sentry_options.dart';
import 'version.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import 'dart:math';
import 'package:sentry/sentry.dart';
import 'package:sentry/src/transport/noop_transport.dart';

import 'client_stub.dart'
if (dart.library.html) 'browser_client.dart'
if (dart.library.io) 'io_client.dart';
import 'protocol.dart';
import 'sentry_client_stub.dart'
if (dart.library.html) 'sentry_browser_client.dart'
if (dart.library.io) 'sentry_io_client.dart';

/// Logs crash reports and events to the Sentry.io service.
abstract class SentryClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'client.dart';
import 'sentry_client.dart';
import 'sentry_options.dart';

/// Implemented in `browser_client.dart` and `io_client.dart`.
/// Implemented in `sentry_browser_client.dart` and `sentry_io_client.dart`.
SentryClient createSentryClient(SentryOptions options) =>
throw UnsupportedError(
'Cannot create a client without dart:html or dart:io.');
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import 'package:sentry/sentry.dart';

/// A pure Dart client for Sentry.io crash reporting.
import 'client.dart';
import 'sentry_client.dart';
import 'sentry_options.dart';

SentryClient createSentryClient(SentryOptions options) =>
Expand Down
2 changes: 1 addition & 1 deletion dart/test/event_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void main() {
'g': 2,
},
fingerprint: const <String>[SentryEvent.defaultFingerprint, 'foo'],
userContext: user,
user: user,
breadcrumbs: breadcrumbs,
).toJson(),
<String, dynamic>{
Expand Down
2 changes: 1 addition & 1 deletion dart/test/mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final fakeEvent = SentryEvent(
tags: const <String, String>{'project-id': '7371'},
extra: const <String, String>{'company-name': 'Dart Inc'},
fingerprint: const <String>['example-dart'],
userContext: const User(
user: const User(
id: '800',
username: 'first-user',
email: '[email protected]',
Expand Down
6 changes: 3 additions & 3 deletions dart/test/sentry_client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void main() {
options.transport.send(captureAny),
).captured.first) as SentryEvent;

expect(capturedEvent.userContext?.id, user.id);
expect(capturedEvent.user?.id, user.id);
expect(capturedEvent.level.name, SentryLevel.error.name);
expect(capturedEvent.transaction, transaction);
expect(capturedEvent.fingerprint, fingerprint);
Expand Down Expand Up @@ -141,7 +141,7 @@ void main() {
final event = SentryEvent(
level: SentryLevel.warning,
transaction: eventTransaction,
userContext: eventUser,
user: eventUser,
fingerprint: eventFingerprint,
breadcrumbs: eventCrumbs,
);
Expand All @@ -164,7 +164,7 @@ void main() {
options.transport.send(captureAny),
).captured.first) as SentryEvent;

expect(capturedEvent.userContext.id, eventUser.id);
expect(capturedEvent.user.id, eventUser.id);
expect(capturedEvent.level.name, SentryLevel.warning.name);
expect(capturedEvent.transaction, eventTransaction);
expect(capturedEvent.fingerprint, eventFingerprint);
Expand Down
2 changes: 1 addition & 1 deletion dart/test/sentry_io_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import 'dart:io';

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

import 'test_utils.dart';
Expand Down
16 changes: 8 additions & 8 deletions dart/test/test_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ void runTest({Codec<List<int>, List<int>> gzip, bool isWeb = false}) {
await client.close();
});

test('$SentryEvent userContext overrides client', () async {
test('$SentryEvent user overrides client', () async {
final fakeClockProvider = () => DateTime.utc(2017, 1, 2);

String loggedUserId; // used to find out what user context was sent
Expand All @@ -337,13 +337,13 @@ void runTest({Codec<List<int>, List<int>> gzip, bool isWeb = false}) {
'Unexpected request on ${request.method} ${request.url} in HttpMock');
});

const clientUserContext = User(
const clientUser = User(
id: 'client_user',
username: 'username',
email: '[email protected]',
ipAddress: '127.0.0.1',
);
const eventUserContext = User(
const eventUser = User(
id: 'event_user',
username: 'username',
email: '[email protected]',
Expand Down Expand Up @@ -375,16 +375,16 @@ void runTest({Codec<List<int>, List<int>> gzip, bool isWeb = false}) {
eventId: SentryId.empty(),
exception: error,
stackTrace: stackTrace,
userContext: eventUserContext,
user: eventUser,
);
await client.captureEvent(eventWithoutContext,
scope: Scope(options)..user = clientUserContext);
expect(loggedUserId, clientUserContext.id);
scope: Scope(options)..user = clientUser);
expect(loggedUserId, clientUser.id);
await client.captureEvent(
eventWithContext,
scope: Scope(options)..user = clientUserContext,
scope: Scope(options)..user = clientUser,
);
expect(loggedUserId, eventUserContext.id);
expect(loggedUserId, eventUser.id);
}

await client.close();
Expand Down