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
renames
  • Loading branch information
vaind committed Oct 3, 2023
commit 6e599fb0f5a965f2724ca3cd630312d2def9a27d
8 changes: 4 additions & 4 deletions dart/lib/src/hub.dart
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ class Hub {
);
}

Profiler? profiler;
SentryProfiler? profiler;
if (_profilerFactory != null &&
_tracesSampler.sampleProfiling(samplingDecision)) {
profiler = _profilerFactory?.startProfiler(transactionContext);
Expand Down Expand Up @@ -563,12 +563,12 @@ class Hub {
_throwableToSpan.add(throwable, span, transaction);

@internal
ProfilerFactory? get profilerFactory => _profilerFactory;
SentryProfilerFactory? get profilerFactory => _profilerFactory;

@internal
set profilerFactory(ProfilerFactory? value) => _profilerFactory = value;
set profilerFactory(SentryProfilerFactory? value) => _profilerFactory = value;

ProfilerFactory? _profilerFactory;
SentryProfilerFactory? _profilerFactory;

SentryEvent _assignTraceContext(SentryEvent event) {
// assign trace context
Expand Down
5 changes: 3 additions & 2 deletions dart/lib/src/hub_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,13 @@ class HubAdapter implements Hub {

@internal
@override
set profilerFactory(ProfilerFactory? value) =>
set profilerFactory(SentryProfilerFactory? value) =>
Sentry.currentHub.profilerFactory = value;

@internal
@override
ProfilerFactory? get profilerFactory => Sentry.currentHub.profilerFactory;
SentryProfilerFactory? get profilerFactory =>
Sentry.currentHub.profilerFactory;

@override
Scope get scope => Sentry.currentHub.scope;
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 @@ -123,11 +123,11 @@ class NoOpHub implements Hub {

@internal
@override
set profilerFactory(ProfilerFactory? value) {}
set profilerFactory(SentryProfilerFactory? value) {}

@internal
@override
ProfilerFactory? get profilerFactory => null;
SentryProfilerFactory? get profilerFactory => null;

@override
Scope get scope => Scope(_options);
Expand Down
10 changes: 5 additions & 5 deletions dart/lib/src/profiling.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import 'package:meta/meta.dart';
import '../sentry.dart';

@internal
abstract class ProfilerFactory {
Profiler? startProfiler(SentryTransactionContext context);
abstract class SentryProfilerFactory {
SentryProfiler? startProfiler(SentryTransactionContext context);
}

@internal
abstract class Profiler {
Future<ProfileInfo?> finishFor(SentryTransaction transaction);
abstract class SentryProfiler {
Future<SentryProfileInfo?> finishFor(SentryTransaction transaction);
void dispose();
}

// See https://develop.sentry.dev/sdk/profiles/
@internal
abstract class ProfileInfo {
abstract class SentryProfileInfo {
SentryEnvelopeItem asEnvelopeItem();
}
4 changes: 2 additions & 2 deletions dart/lib/src/sentry_tracer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class SentryTracer extends ISentrySpan {
SentryTraceContextHeader? _sentryTraceContextHeader;

// Profiler attached to this tracer.
late final Profiler? profiler;
late final SentryProfiler? profiler;

// Resulting profile, after it has been collected. This is later used by
// SentryClient to attach as an envelope item when sending the transaction.
ProfileInfo? profileInfo;
SentryProfileInfo? profileInfo;

/// If [waitForChildren] is true, this transaction will not finish until all
/// its children are finished.
Expand Down
6 changes: 3 additions & 3 deletions dart/test/mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ class MockRateLimiter implements RateLimiter {
}

@GenerateMocks([
ProfilerFactory,
Profiler,
ProfileInfo,
SentryProfilerFactory,
SentryProfiler,
SentryProfileInfo,
])
void main() {}
30 changes: 16 additions & 14 deletions dart/test/mocks.mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,39 +31,41 @@ class _FakeSentryEnvelopeItem_0 extends _i1.SmartFake
);
}

/// A class which mocks [ProfilerFactory].
/// A class which mocks [SentryProfilerFactory].
///
/// See the documentation for Mockito's code generation for more information.
class MockProfilerFactory extends _i1.Mock implements _i3.ProfilerFactory {
MockProfilerFactory() {
class MockSentryProfilerFactory extends _i1.Mock
implements _i3.SentryProfilerFactory {
MockSentryProfilerFactory() {
_i1.throwOnMissingStub(this);
}

@override
_i3.Profiler? startProfiler(_i2.SentryTransactionContext? context) =>
_i3.SentryProfiler? startProfiler(_i2.SentryTransactionContext? context) =>
(super.noSuchMethod(Invocation.method(
#startProfiler,
[context],
)) as _i3.Profiler?);
)) as _i3.SentryProfiler?);
}

/// A class which mocks [Profiler].
/// A class which mocks [SentryProfiler].
///
/// See the documentation for Mockito's code generation for more information.
class MockProfiler extends _i1.Mock implements _i3.Profiler {
MockProfiler() {
class MockSentryProfiler extends _i1.Mock implements _i3.SentryProfiler {
MockSentryProfiler() {
_i1.throwOnMissingStub(this);
}

@override
_i4.Future<_i3.ProfileInfo?> finishFor(_i2.SentryTransaction? transaction) =>
_i4.Future<_i3.SentryProfileInfo?> finishFor(
_i2.SentryTransaction? transaction) =>
(super.noSuchMethod(
Invocation.method(
#finishFor,
[transaction],
),
returnValue: _i4.Future<_i3.ProfileInfo?>.value(),
) as _i4.Future<_i3.ProfileInfo?>);
returnValue: _i4.Future<_i3.SentryProfileInfo?>.value(),
) as _i4.Future<_i3.SentryProfileInfo?>);
@override
void dispose() => super.noSuchMethod(
Invocation.method(
Expand All @@ -74,11 +76,11 @@ class MockProfiler extends _i1.Mock implements _i3.Profiler {
);
}

/// A class which mocks [ProfileInfo].
/// A class which mocks [SentryProfileInfo].
///
/// See the documentation for Mockito's code generation for more information.
class MockProfileInfo extends _i1.Mock implements _i3.ProfileInfo {
MockProfileInfo() {
class MockSentryProfileInfo extends _i1.Mock implements _i3.SentryProfileInfo {
MockSentryProfileInfo() {
_i1.throwOnMissingStub(this);
}

Expand Down
6 changes: 3 additions & 3 deletions flutter/lib/src/profiling.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import '../sentry_flutter.dart';
import 'native/sentry_native.dart';

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

Expand Down Expand Up @@ -52,7 +52,7 @@ class NativeProfilerFactory implements ProfilerFactory {
}

// ignore: invalid_use_of_internal_member
class NativeProfiler implements Profiler {
class NativeProfiler implements SentryProfiler {
final SentryNative _native;
final int _starTimeNs;
final SentryId _traceId;
Expand Down Expand Up @@ -96,7 +96,7 @@ class NativeProfiler implements Profiler {
}

// ignore: invalid_use_of_internal_member
class NativeProfileInfo implements ProfileInfo {
class NativeProfileInfo implements SentryProfileInfo {
final Map<String, dynamic> _payload;
// ignore: invalid_use_of_internal_member
late final List<int> _data = utf8JsonEncoder.convert(_payload);
Expand Down
6 changes: 3 additions & 3 deletions flutter/test/mocks.mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,15 @@ class MockSentryTracer extends _i1.Mock implements _i4.SentryTracer {
returnValueForMissingStub: null,
);
@override
set profiler(_i9.Profiler? _profiler) => super.noSuchMethod(
set profiler(_i9.SentryProfiler? _profiler) => super.noSuchMethod(
Invocation.setter(
#profiler,
_profiler,
),
returnValueForMissingStub: null,
);
@override
set profileInfo(_i9.ProfileInfo? _profileInfo) => super.noSuchMethod(
set profileInfo(_i9.SentryProfileInfo? _profileInfo) => super.noSuchMethod(
Invocation.setter(
#profileInfo,
_profileInfo,
Expand Down Expand Up @@ -797,7 +797,7 @@ class MockHub extends _i1.Mock implements _i2.Hub {
),
) as _i2.Scope);
@override
set profilerFactory(_i9.ProfilerFactory? value) => super.noSuchMethod(
set profilerFactory(_i9.SentryProfilerFactory? value) => super.noSuchMethod(
Invocation.setter(
#profilerFactory,
value,
Expand Down