Skip to content

Commit 553f739

Browse files
committed
fix API breakage
1 parent 1e1ddde commit 553f739

File tree

11 files changed

+28
-32
lines changed

11 files changed

+28
-32
lines changed

dart/lib/src/hub.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,6 @@ class Hub {
502502
Future<SentryId> captureTransaction(
503503
SentryTransaction transaction, {
504504
SentryTraceContextHeader? traceContext,
505-
ProfileInfo? profileInfo,
506505
}) async {
507506
var sentryId = SentryId.empty();
508507

@@ -539,7 +538,6 @@ class Hub {
539538
transaction,
540539
scope: item.scope,
541540
traceContext: traceContext,
542-
profileInfo: profileInfo,
543541
);
544542
} catch (exception, stackTrace) {
545543
_options.logger(

dart/lib/src/hub_adapter.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ class HubAdapter implements Hub {
9898
@override
9999
Future<SentryId> captureTransaction(
100100
SentryTransaction transaction, {
101-
SentryTraceContextHeader? traceContext,
102-
ProfileInfo? profileInfo,
101+
SentryTraceContextHeader? traceContext
103102
}) =>
104103
Sentry.currentHub.captureTransaction(
105104
transaction,

dart/lib/src/noop_hub.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ class NoOpHub implements Hub {
8080
Future<SentryId> captureTransaction(
8181
SentryTransaction transaction, {
8282
SentryTraceContextHeader? traceContext,
83-
ProfileInfo? profileInfo,
8483
}) async =>
8584
SentryId.empty();
8685

dart/lib/src/protocol/sentry_transaction.dart

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:meta/meta.dart';
22

3-
import '../profiling.dart';
43
import '../protocol.dart';
54
import '../sentry_tracer.dart';
65
import '../utils.dart';
@@ -11,12 +10,13 @@ class SentryTransaction extends SentryEvent {
1110
late final DateTime startTimestamp;
1211
static const String _type = 'transaction';
1312
late final List<SentrySpan> spans;
14-
final SentryTracer _tracer;
13+
@internal
14+
final SentryTracer tracer;
1515
late final Map<String, SentryMeasurement> measurements;
1616
late final SentryTransactionInfo? transactionInfo;
1717

1818
SentryTransaction(
19-
this._tracer, {
19+
this.tracer, {
2020
SentryId? eventId,
2121
DateTime? timestamp,
2222
String? platform,
@@ -40,37 +40,37 @@ class SentryTransaction extends SentryEvent {
4040
SentryTransactionInfo? transactionInfo,
4141
}) : super(
4242
eventId: eventId,
43-
timestamp: timestamp ?? _tracer.endTimestamp,
43+
timestamp: timestamp ?? tracer.endTimestamp,
4444
platform: platform,
4545
serverName: serverName,
4646
release: release,
4747
dist: dist,
4848
environment: environment,
49-
transaction: transaction ?? _tracer.name,
50-
throwable: throwable ?? _tracer.throwable,
51-
tags: tags ?? _tracer.tags,
49+
transaction: transaction ?? tracer.name,
50+
throwable: throwable ?? tracer.throwable,
51+
tags: tags ?? tracer.tags,
5252
// ignore: deprecated_member_use_from_same_package
53-
extra: extra ?? _tracer.data,
53+
extra: extra ?? tracer.data,
5454
user: user,
5555
contexts: contexts,
5656
breadcrumbs: breadcrumbs,
5757
sdk: sdk,
5858
request: request,
5959
type: _type,
6060
) {
61-
startTimestamp = _tracer.startTimestamp;
61+
startTimestamp = tracer.startTimestamp;
6262

63-
final spanContext = _tracer.context;
64-
spans = _tracer.children;
63+
final spanContext = tracer.context;
64+
spans = tracer.children;
6565
this.measurements = measurements ?? {};
6666

6767
this.contexts.trace = spanContext.toTraceContext(
68-
sampled: _tracer.samplingDecision?.sampled,
69-
status: _tracer.status,
68+
sampled: tracer.samplingDecision?.sampled,
69+
status: tracer.status,
7070
);
7171

7272
this.transactionInfo = transactionInfo ??
73-
SentryTransactionInfo(_tracer.transactionNameSource.name);
73+
SentryTransactionInfo(tracer.transactionNameSource.name);
7474
}
7575

7676
@override
@@ -137,7 +137,7 @@ class SentryTransaction extends SentryEvent {
137137
SentryTransactionInfo? transactionInfo,
138138
}) =>
139139
SentryTransaction(
140-
_tracer,
140+
tracer,
141141
eventId: eventId ?? this.eventId,
142142
timestamp: timestamp ?? this.timestamp,
143143
platform: platform ?? this.platform,

dart/lib/src/sentry_client.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'dart:async';
22
import 'dart:math';
33
import 'package:meta/meta.dart';
4-
import 'profiling.dart';
54
import 'sentry_attachment/sentry_attachment.dart';
65

76
import 'event_processor.dart';
@@ -285,7 +284,6 @@ class SentryClient {
285284
SentryTransaction transaction, {
286285
Scope? scope,
287286
SentryTraceContextHeader? traceContext,
288-
ProfileInfo? profileInfo,
289287
}) async {
290288
SentryTransaction? preparedTransaction =
291289
_prepareEvent(transaction) as SentryTransaction;
@@ -333,6 +331,8 @@ class SentryClient {
333331
traceContext: traceContext,
334332
attachments: attachments,
335333
);
334+
335+
final profileInfo = preparedTransaction.tracer.profileInfo;
336336
if (profileInfo != null) {
337337
envelope.items.add(profileInfo.asEnvelopeItem());
338338
}

dart/lib/src/sentry_envelope_item.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'dart:async';
22
import 'dart:convert';
3-
import 'package:meta/meta.dart';
43

54
import 'client_reports/client_report.dart';
65
import 'protocol.dart';

dart/lib/src/sentry_tracer.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ class SentryTracer extends ISentrySpan {
3232

3333
SentryTraceContextHeader? _sentryTraceContextHeader;
3434

35+
// Profiler attached to this tracer.
3536
late final Profiler? profiler;
3637

38+
// Resulting profile, after it has been collected. This is later used by
39+
// SentryClient to attach as an envelope item when sending the transaction.
40+
ProfileInfo? profileInfo;
41+
3742
/// If [waitForChildren] is true, this transaction will not finish until all
3843
/// its children are finished.
3944
///
@@ -141,14 +146,13 @@ class SentryTracer extends ISentrySpan {
141146
final transaction = SentryTransaction(this);
142147
transaction.measurements.addAll(_measurements);
143148

144-
final profileInfo = (status == null || status == SpanStatus.ok())
149+
profileInfo = (status == null || status == SpanStatus.ok())
145150
? await profiler?.finishFor(transaction)
146151
: null;
147152

148153
await _hub.captureTransaction(
149154
transaction,
150155
traceContext: traceContext(),
151-
profileInfo: profileInfo,
152156
);
153157
} finally {
154158
profiler?.dispose();

dart/test/hub_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import 'package:collection/collection.dart';
22
import 'package:mockito/mockito.dart';
33
import 'package:sentry/sentry.dart';
44
import 'package:sentry/src/client_reports/discard_reason.dart';
5-
import 'package:sentry/src/profiling.dart';
65
import 'package:sentry/src/sentry_tracer.dart';
76
import 'package:sentry/src/transport/data_category.dart';
87
import 'package:test/test.dart';

dart/test/mocks/mock_hub.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:meta/meta.dart';
22
import 'package:sentry/sentry.dart';
3-
import 'package:sentry/src/profiling.dart';
43

54
import '../mocks.dart';
65
import 'mock_sentry_client.dart';
@@ -111,7 +110,6 @@ class MockHub with NoSuchMethodProvider implements Hub {
111110
Future<SentryId> captureTransaction(
112111
SentryTransaction transaction, {
113112
SentryTraceContextHeader? traceContext,
114-
ProfileInfo? profileInfo,
115113
}) async {
116114
captureTransactionCalls
117115
.add(CaptureTransactionCall(transaction, traceContext));

dart/test/mocks/mock_sentry_client.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'package:sentry/sentry.dart';
2-
import 'package:sentry/src/profiling.dart';
32

43
import 'no_such_method_provider.dart';
54

@@ -85,7 +84,6 @@ class MockSentryClient with NoSuchMethodProvider implements SentryClient {
8584
SentryTransaction transaction, {
8685
Scope? scope,
8786
SentryTraceContextHeader? traceContext,
88-
ProfileInfo? profileInfo,
8987
}) async {
9088
captureTransactionCalls
9189
.add(CaptureTransactionCall(transaction, traceContext));

0 commit comments

Comments
 (0)