Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6a35dad
Move to local dependency
vishnukvmd May 28, 2022
1ba4085
Pass DSN within the SentryEnvelopeHeader
vishnukvmd May 28, 2022
a6fb6c0
Switch to remote dependency as an override is already declared
vishnukvmd Jun 14, 2022
152d32a
Merge branch 'main' into sentry_tunnel
ua741 Sep 27, 2022
3502ee4
Fix broken tests
ua741 Sep 27, 2022
bd69848
Fix test
ua741 Sep 28, 2022
93b03da
fix lint
marandaneto Oct 7, 2022
a6310cb
Merge branch 'main' into sentry_tunnel
marandaneto Oct 7, 2022
7534e82
fix
marandaneto Oct 7, 2022
647697c
fix tests
marandaneto Oct 7, 2022
0cb505d
pr id
marandaneto Oct 7, 2022
4f8a29c
pr id
marandaneto Oct 7, 2022
441d14f
add tests
marandaneto Oct 7, 2022
7dc6ab3
Merge branch 'main' into sentry_tunnel
marandaneto Oct 7, 2022
52265fe
fix
marandaneto Oct 7, 2022
78b8b57
Merge branch 'main' into sentry_tunnel
marandaneto Oct 7, 2022
65df091
Merge branch 'sentry_tunnel' of github.com:getsentry/sentry-dart into…
marandaneto Oct 7, 2022
06fc8cf
remove
marandaneto Oct 7, 2022
64c803f
fix
marandaneto Oct 7, 2022
fa35f2e
Merge branch 'main' into sentry_tunnel
marandaneto Oct 7, 2022
614334e
move bytes to file
marandaneto Oct 7, 2022
3b552e2
Merge branch 'main' into sentry_tunnel
marandaneto Oct 7, 2022
0742cde
Merge branch 'sentry_tunnel' of github.com:getsentry/sentry-dart into…
marandaneto Oct 7, 2022
9cd0ac9
test
marandaneto Oct 7, 2022
a33faf9
Merge branch 'main' into sentry_tunnel
marandaneto Oct 7, 2022
a0ef68c
lf fix
marandaneto Oct 7, 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
Prev Previous commit
Next Next commit
Merge branch 'main' into sentry_tunnel
  • Loading branch information
ua741 committed Sep 27, 2022
commit 152d32a18287bea0d612704a0e20630fb254164c
5 changes: 3 additions & 2 deletions dart/lib/src/sentry_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ class SentryClient {
final envelope = SentryEnvelope.fromEvent(
preparedEvent,
_options.sdk,
_options.dsn,
attachments: scope?.attachements,
dsn: _options.dsn,
traceContext: scope?.span?.traceContext(),
attachments: scope?.attachments,
);

final id = await captureEnvelope(envelope);
Expand Down
23 changes: 18 additions & 5 deletions dart/lib/src/sentry_envelope.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@ class SentryEnvelope {
/// Create an [SentryEnvelope] with containing one [SentryEnvelopeItem] which holds the [SentryEvent] data.
factory SentryEnvelope.fromEvent(
SentryEvent event,
SdkVersion sdkVersion,
String? dsn, {
SdkVersion sdkVersion, {
String? dsn,
SentryTraceContextHeader? traceContext,
List<SentryAttachment>? attachments,
}) {
return SentryEnvelope(
SentryEnvelopeHeader(event.eventId, sdkVersion, dsn),
SentryEnvelopeHeader(
event.eventId,
sdkVersion,
dsn: dsn,
traceContext: traceContext,
),
[
SentryEnvelopeItem.fromEvent(event),
if (attachments != null)
Expand All @@ -42,7 +48,8 @@ class SentryEnvelope {
SdkVersion sdkVersion,
) {
return SentryEnvelope(
SentryEnvelopeHeader(feedback.eventId, sdkVersion, null),
// no need for [traceContext]
SentryEnvelopeHeader(feedback.eventId, sdkVersion),
[SentryEnvelopeItem.fromUserFeedback(feedback)],
);
}
Expand All @@ -51,11 +58,17 @@ class SentryEnvelope {
factory SentryEnvelope.fromTransaction(
SentryTransaction transaction,
SdkVersion sdkVersion, {
String? dsn,
SentryTraceContextHeader? traceContext,
List<SentryAttachment>? attachments,
}) {
return SentryEnvelope(
SentryEnvelopeHeader(transaction.eventId, sdkVersion, null),
SentryEnvelopeHeader(
transaction.eventId,
sdkVersion,
dsn: dsn,
traceContext: traceContext,
),
[
SentryEnvelopeItem.fromTransaction(transaction),
if (attachments != null)
Expand Down
18 changes: 16 additions & 2 deletions dart/lib/src/sentry_envelope_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,26 @@ import 'sentry_trace_context_header.dart';

/// Header containing `SentryId` and `SdkVersion`.
class SentryEnvelopeHeader {
SentryEnvelopeHeader(this.eventId, this.sdkVersion, this.dsn);
SentryEnvelopeHeader(
this.eventId,
this.sdkVersion, {
this.dsn,
this.traceContext,
});
SentryEnvelopeHeader.newEventId()
: eventId = SentryId.newId(),
sdkVersion = null,
dsn = null;
dsn = null,
traceContext = null;

/// The identifier of encoded `SentryEvent`.
final SentryId? eventId;

/// The `SdkVersion` with which the envelope was send.
final SdkVersion? sdkVersion;

final SentryTraceContextHeader? traceContext;

/// The `DSN` of the Sentry project.
final String? dsn;

Expand All @@ -32,6 +40,12 @@ class SentryEnvelopeHeader {
if (tempSdkVersion != null) {
json['sdk'] = tempSdkVersion.toJson();
}

final tempTraceContext = traceContext;
if (tempTraceContext != null) {
json['trace'] = tempTraceContext.toJson();
}

if (dsn != null) {
json['dsn'] = dsn;
}
Expand Down
10 changes: 9 additions & 1 deletion dart/test/sentry_envelope_header_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ void main() {
name: 'fixture-sdkName',
version: 'fixture-version',
);
final sut = SentryEnvelopeHeader(eventId, sdkVersion, null);
final context = SentryTraceContextHeader.fromJson(<String, dynamic>{
'trace_id': '${SentryId.newId()}',
'public_key': '123',
});
final sut = SentryEnvelopeHeader(
eventId,
sdkVersion,
traceContext: context,
);
final expextedSkd = sdkVersion.toJson();
final expected = <String, dynamic>{
'event_id': eventId.toString(),
Expand Down
22 changes: 19 additions & 3 deletions dart/test/sentry_envelope_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ void main() {

final item = SentryEnvelopeItem(itemHeader, dataFactory);

final header = SentryEnvelopeHeader(eventId, null, null);
final context = SentryTraceContextHeader.fromJson(<String, dynamic>{
'trace_id': '${SentryId.newId()}',
'public_key': '123',
});
final header = SentryEnvelopeHeader(
eventId,
null,
traceContext: context,
);
final sut = SentryEnvelope(header, [item, item]);

final expectedHeaderJson = header.toJson();
Expand All @@ -52,9 +60,17 @@ void main() {
final sentryEvent = SentryEvent(eventId: eventId);
final sdkVersion =
SdkVersion(name: 'fixture-name', version: 'fixture-version');
final context = SentryTraceContextHeader.fromJson(<String, dynamic>{
'trace_id': '${SentryId.newId()}',
'public_key': '123',
});
final fakeDsn = 'https://[email protected]/1234567';
final sut =
SentryEnvelope.fromEvent(sentryEvent, sdkVersion, fakeDsn);
final sut = SentryEnvelope.fromEvent(
sentryEvent,
sdkVersion,
dsn: fakeDsn,
traceContext: context,
);

final expectedEnvelopeItem = SentryEnvelopeItem.fromEvent(sentryEvent);

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.