Skip to content

Commit

Permalink
renames
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Oct 3, 2023
1 parent 50994d4 commit 6e599fb
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 38 deletions.
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

0 comments on commit 6e599fb

Please sign in to comment.