Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
696ba61
todo
vaind Aug 17, 2023
4f85144
feat: expose cocoa profiling via method channels
vaind Aug 18, 2023
de6f244
feat: prepare profiler interfaces and hub integration
vaind Aug 22, 2023
7c73348
fix CI
vaind Aug 23, 2023
42af467
integrate dart & cocoa profiling
vaind Aug 24, 2023
162c2ba
fix API breakage
vaind Aug 26, 2023
31a92e5
fix tests
vaind Aug 28, 2023
b12978e
dart format
vaind Aug 28, 2023
3582adf
ci: fix pana
vaind Aug 29, 2023
1d74bac
update tests
vaind Aug 29, 2023
8d23d3f
analysis issues
vaind Aug 29, 2023
c9be10c
update to the latest cocoa SDK API
vaind Sep 5, 2023
32c6e5d
linter issue
vaind Sep 7, 2023
0ae79d4
fix import
vaind Sep 12, 2023
df9fb5b
refactor: SentryNative integration
vaind Sep 12, 2023
0fb649c
update cocoa native binding to use ffi startProfiler()
vaind Sep 12, 2023
dccb853
tmp: findPrimeNumber in example
vaind Sep 12, 2023
6119812
fix: make FFI dependency conditional (web/vm)
vaind Sep 18, 2023
5218efa
exclude generated binding code from code coverage
vaind Sep 18, 2023
4c8f2bf
test: profiler integration test
vaind Sep 18, 2023
e0bb3ab
workaround for the integration test issue
vaind Sep 18, 2023
8a4fed7
chore: formatting
vaind Sep 19, 2023
2d29cb6
Merge branch 'main' into feat/profiling
vaind Sep 19, 2023
4748a00
Merge branch 'main' into feat/profiling
vaind Sep 20, 2023
39d1187
chore: remove obsolete code
vaind Sep 25, 2023
50994d4
Update flutter/example/lib/main.dart
vaind Oct 3, 2023
6e599fb
renames
vaind Oct 3, 2023
e7582d7
Breadcrumbs for file I/O operations (#1649)
denrase Sep 25, 2023
36b052e
ci: don't run CI on markdown updates (#1651)
vaind Sep 25, 2023
813b947
fixup mock names after renames
vaind Oct 3, 2023
ce59509
Merge branch 'main' into feat/profiling
stefanosiano Oct 4, 2023
e13e7de
more renames (Sentry prefix)
vaind Oct 4, 2023
8e6bd13
chore: update changelog
vaind Oct 4, 2023
227b701
Merge branch 'main' into feat/profiling
vaind Oct 26, 2023
defdfa6
don't inline findPrimeNumber profiler-test function
vaind Oct 27, 2023
4074f01
fixup changelog
vaind Oct 27, 2023
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
more renames (Sentry prefix)
  • Loading branch information
vaind committed Oct 4, 2023
commit e13e7de78e8c0b2705bbe2aa4d4d4c5f65229100
24 changes: 13 additions & 11 deletions flutter/lib/src/profiling.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import '../sentry_flutter.dart';
import 'native/sentry_native.dart';

// ignore: invalid_use_of_internal_member
class NativeProfilerFactory implements SentryProfilerFactory {
class SentryNativeProfilerFactory implements SentryProfilerFactory {
final SentryNative _native;
final ClockProvider _clock;

NativeProfilerFactory(this._native, this._clock);
SentryNativeProfilerFactory(this._native, this._clock);

static void attachTo(Hub hub, SentryNative native) {
// ignore: invalid_use_of_internal_member
Expand All @@ -33,12 +33,12 @@ class NativeProfilerFactory implements SentryProfilerFactory {
if (options.platformChecker.platform.isMacOS ||
options.platformChecker.platform.isIOS) {
// ignore: invalid_use_of_internal_member
hub.profilerFactory = NativeProfilerFactory(native, options.clock);
hub.profilerFactory = SentryNativeProfilerFactory(native, options.clock);
}
}

@override
NativeProfiler? startProfiler(SentryTransactionContext context) {
SentryNativeProfiler? startProfiler(SentryTransactionContext context) {
if (context.traceId == SentryId.empty()) {
return null;
}
Expand All @@ -47,19 +47,20 @@ class NativeProfilerFactory implements SentryProfilerFactory {
if (startTime == null) {
return null;
}
return NativeProfiler(_native, startTime, context.traceId, _clock);
return SentryNativeProfiler(_native, startTime, context.traceId, _clock);
}
}

// ignore: invalid_use_of_internal_member
class NativeProfiler implements SentryProfiler {
class SentryNativeProfiler implements SentryProfiler {
final SentryNative _native;
final int _starTimeNs;
final SentryId _traceId;
bool _finished = false;
final ClockProvider _clock;

NativeProfiler(this._native, this._starTimeNs, this._traceId, this._clock);
SentryNativeProfiler(
this._native, this._starTimeNs, this._traceId, this._clock);

@override
void dispose() {
Expand All @@ -70,7 +71,8 @@ class NativeProfiler implements SentryProfiler {
}

@override
Future<NativeProfileInfo?> finishFor(SentryTransaction transaction) async {
Future<SentryNativeProfileInfo?> finishFor(
SentryTransaction transaction) async {
if (_finished) {
return null;
}
Expand All @@ -91,17 +93,17 @@ class NativeProfiler implements SentryProfiler {
payload["transaction"]["trace_id"] = _traceId.toString();
payload["transaction"]["name"] = transaction.transaction;
payload["timestamp"] = transaction.startTimestamp.toIso8601String();
return NativeProfileInfo(payload);
return SentryNativeProfileInfo(payload);
}
}

// ignore: invalid_use_of_internal_member
class NativeProfileInfo implements SentryProfileInfo {
class SentryNativeProfileInfo implements SentryProfileInfo {
final Map<String, dynamic> _payload;
// ignore: invalid_use_of_internal_member
late final List<int> _data = utf8JsonEncoder.convert(_payload);

NativeProfileInfo(this._payload);
SentryNativeProfileInfo(this._payload);

@override
SentryEnvelopeItem asEnvelopeItem() {
Expand Down
2 changes: 1 addition & 1 deletion flutter/lib/src/sentry_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ mixin SentryFlutter {

if (_native != null) {
// ignore: invalid_use_of_internal_member
NativeProfilerFactory.attachTo(Sentry.currentHub, _native!);
SentryNativeProfilerFactory.attachTo(Sentry.currentHub, _native!);
}
}

Expand Down
98 changes: 36 additions & 62 deletions flutter/test/mocks.mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,9 @@ class _FakeSentryTracer_4 extends _i1.SmartFake implements _i4.SentryTracer {
);
}

class _FakeSentryId_5 extends _i1.SmartFake implements _i3.SentryId {
_FakeSentryId_5(
Object parent,
Invocation parentInvocation,
) : super(
parent,
parentInvocation,
);
}

class _FakeContexts_6 extends _i1.SmartFake implements _i3.Contexts {
_FakeContexts_6(
class _FakeSentryTransaction_5 extends _i1.SmartFake
implements _i3.SentryTransaction {
_FakeSentryTransaction_5(
Object parent,
Invocation parentInvocation,
) : super(
Expand All @@ -100,9 +91,8 @@ class _FakeContexts_6 extends _i1.SmartFake implements _i3.Contexts {
);
}

class _FakeSentryTransaction_7 extends _i1.SmartFake
implements _i3.SentryTransaction {
_FakeSentryTransaction_7(
class _FakeMethodCodec_6 extends _i1.SmartFake implements _i5.MethodCodec {
_FakeMethodCodec_6(
Object parent,
Invocation parentInvocation,
) : super(
Expand All @@ -111,8 +101,9 @@ class _FakeSentryTransaction_7 extends _i1.SmartFake
);
}

class _FakeMethodCodec_8 extends _i1.SmartFake implements _i5.MethodCodec {
_FakeMethodCodec_8(
class _FakeBinaryMessenger_7 extends _i1.SmartFake
implements _i6.BinaryMessenger {
_FakeBinaryMessenger_7(
Object parent,
Invocation parentInvocation,
) : super(
Expand All @@ -121,9 +112,8 @@ class _FakeMethodCodec_8 extends _i1.SmartFake implements _i5.MethodCodec {
);
}

class _FakeBinaryMessenger_9 extends _i1.SmartFake
implements _i6.BinaryMessenger {
_FakeBinaryMessenger_9(
class _FakeSentryOptions_8 extends _i1.SmartFake implements _i2.SentryOptions {
_FakeSentryOptions_8(
Object parent,
Invocation parentInvocation,
) : super(
Expand All @@ -132,8 +122,8 @@ class _FakeBinaryMessenger_9 extends _i1.SmartFake
);
}

class _FakeSentryOptions_10 extends _i1.SmartFake implements _i2.SentryOptions {
_FakeSentryOptions_10(
class _FakeSentryId_9 extends _i1.SmartFake implements _i3.SentryId {
_FakeSentryId_9(
Object parent,
Invocation parentInvocation,
) : super(
Expand All @@ -142,8 +132,8 @@ class _FakeSentryOptions_10 extends _i1.SmartFake implements _i2.SentryOptions {
);
}

class _FakeScope_11 extends _i1.SmartFake implements _i2.Scope {
_FakeScope_11(
class _FakeScope_10 extends _i1.SmartFake implements _i2.Scope {
_FakeScope_10(
Object parent,
Invocation parentInvocation,
) : super(
Expand All @@ -152,8 +142,8 @@ class _FakeScope_11 extends _i1.SmartFake implements _i2.Scope {
);
}

class _FakeHub_12 extends _i1.SmartFake implements _i2.Hub {
_FakeHub_12(
class _FakeHub_11 extends _i1.SmartFake implements _i2.Hub {
_FakeHub_11(
Object parent,
Invocation parentInvocation,
) : super(
Expand Down Expand Up @@ -282,7 +272,7 @@ class MockSentryTracer extends _i1.Mock implements _i4.SentryTracer {
returnValueForMissingStub: null,
);
@override
set status(_i3.SpanStatus? status) => super.noSuchMethod(
set status(dynamic status) => super.noSuchMethod(
Invocation.setter(
#status,
status,
Expand All @@ -301,7 +291,7 @@ class MockSentryTracer extends _i1.Mock implements _i4.SentryTracer {
) as Map<String, _i2.SentryMeasurement>);
@override
_i7.Future<void> finish({
_i3.SpanStatus? status,
dynamic status,
DateTime? endTimestamp,
}) =>
(super.noSuchMethod(
Expand Down Expand Up @@ -391,7 +381,7 @@ class MockSentryTracer extends _i1.Mock implements _i4.SentryTracer {
) as _i2.ISentrySpan);
@override
_i2.ISentrySpan startChildWithParentSpanId(
_i3.SpanId? parentSpanId,
dynamic parentSpanId,
String? operation, {
String? description,
DateTime? startTimestamp,
Expand Down Expand Up @@ -544,22 +534,6 @@ class MockSentryTransaction extends _i1.Mock implements _i3.SentryTransaction {
returnValue: false,
) as bool);
@override
_i3.SentryId get eventId => (super.noSuchMethod(
Invocation.getter(#eventId),
returnValue: _FakeSentryId_5(
this,
Invocation.getter(#eventId),
),
) as _i3.SentryId);
@override
_i3.Contexts get contexts => (super.noSuchMethod(
Invocation.getter(#contexts),
returnValue: _FakeContexts_6(
this,
Invocation.getter(#contexts),
),
) as _i3.Contexts);
@override
Map<String, dynamic> toJson() => (super.noSuchMethod(
Invocation.method(
#toJson,
Expand All @@ -578,7 +552,7 @@ class MockSentryTransaction extends _i1.Mock implements _i3.SentryTransaction {
String? dist,
String? environment,
Map<String, String>? modules,
_i3.SentryMessage? message,
dynamic message,
String? transaction,
dynamic throwable,
_i3.SentryLevel? level,
Expand All @@ -587,13 +561,13 @@ class MockSentryTransaction extends _i1.Mock implements _i3.SentryTransaction {
Map<String, dynamic>? extra,
List<String>? fingerprint,
_i3.SentryUser? user,
_i3.Contexts? contexts,
dynamic contexts,
List<_i3.Breadcrumb>? breadcrumbs,
_i3.SdkVersion? sdk,
_i3.SentryRequest? request,
_i3.DebugMeta? debugMeta,
dynamic request,
dynamic debugMeta,
List<_i3.SentryException>? exceptions,
List<_i3.SentryThread>? threads,
List<dynamic>? threads,
String? type,
Map<String, _i2.SentryMeasurement>? measurements,
_i3.SentryTransactionInfo? transactionInfo,
Expand Down Expand Up @@ -633,7 +607,7 @@ class MockSentryTransaction extends _i1.Mock implements _i3.SentryTransaction {
#transactionInfo: transactionInfo,
},
),
returnValue: _FakeSentryTransaction_7(
returnValue: _FakeSentryTransaction_5(
this,
Invocation.method(
#copyWith,
Expand Down Expand Up @@ -689,15 +663,15 @@ class MockMethodChannel extends _i1.Mock implements _i10.MethodChannel {
@override
_i5.MethodCodec get codec => (super.noSuchMethod(
Invocation.getter(#codec),
returnValue: _FakeMethodCodec_8(
returnValue: _FakeMethodCodec_6(
this,
Invocation.getter(#codec),
),
) as _i5.MethodCodec);
@override
_i6.BinaryMessenger get binaryMessenger => (super.noSuchMethod(
Invocation.getter(#binaryMessenger),
returnValue: _FakeBinaryMessenger_9(
returnValue: _FakeBinaryMessenger_7(
this,
Invocation.getter(#binaryMessenger),
),
Expand Down Expand Up @@ -770,7 +744,7 @@ class MockHub extends _i1.Mock implements _i2.Hub {
@override
_i2.SentryOptions get options => (super.noSuchMethod(
Invocation.getter(#options),
returnValue: _FakeSentryOptions_10(
returnValue: _FakeSentryOptions_8(
this,
Invocation.getter(#options),
),
Expand All @@ -783,15 +757,15 @@ class MockHub extends _i1.Mock implements _i2.Hub {
@override
_i3.SentryId get lastEventId => (super.noSuchMethod(
Invocation.getter(#lastEventId),
returnValue: _FakeSentryId_5(
returnValue: _FakeSentryId_9(
this,
Invocation.getter(#lastEventId),
),
) as _i3.SentryId);
@override
_i2.Scope get scope => (super.noSuchMethod(
Invocation.getter(#scope),
returnValue: _FakeScope_11(
returnValue: _FakeScope_10(
this,
Invocation.getter(#scope),
),
Expand All @@ -806,7 +780,7 @@ class MockHub extends _i1.Mock implements _i2.Hub {
);
@override
_i7.Future<_i3.SentryId> captureEvent(
_i3.SentryEvent? event, {
dynamic event, {
dynamic stackTrace,
_i2.Hint? hint,
_i2.ScopeCallback? withScope,
Expand All @@ -821,7 +795,7 @@ class MockHub extends _i1.Mock implements _i2.Hub {
#withScope: withScope,
},
),
returnValue: _i7.Future<_i3.SentryId>.value(_FakeSentryId_5(
returnValue: _i7.Future<_i3.SentryId>.value(_FakeSentryId_9(
this,
Invocation.method(
#captureEvent,
Expand Down Expand Up @@ -851,7 +825,7 @@ class MockHub extends _i1.Mock implements _i2.Hub {
#withScope: withScope,
},
),
returnValue: _i7.Future<_i3.SentryId>.value(_FakeSentryId_5(
returnValue: _i7.Future<_i3.SentryId>.value(_FakeSentryId_9(
this,
Invocation.method(
#captureException,
Expand Down Expand Up @@ -885,7 +859,7 @@ class MockHub extends _i1.Mock implements _i2.Hub {
#withScope: withScope,
},
),
returnValue: _i7.Future<_i3.SentryId>.value(_FakeSentryId_5(
returnValue: _i7.Future<_i3.SentryId>.value(_FakeSentryId_9(
this,
Invocation.method(
#captureMessage,
Expand Down Expand Up @@ -938,7 +912,7 @@ class MockHub extends _i1.Mock implements _i2.Hub {
#clone,
[],
),
returnValue: _FakeHub_12(
returnValue: _FakeHub_11(
this,
Invocation.method(
#clone,
Expand Down Expand Up @@ -1058,7 +1032,7 @@ class MockHub extends _i1.Mock implements _i2.Hub {
[transaction],
{#traceContext: traceContext},
),
returnValue: _i7.Future<_i3.SentryId>.value(_FakeSentryId_5(
returnValue: _i7.Future<_i3.SentryId>.value(_FakeSentryId_9(
this,
Invocation.method(
#captureTransaction,
Expand Down
Loading