From 6e599fb0f5a965f2724ca3cd630312d2def9a27d Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 3 Oct 2023 21:23:37 +0200 Subject: [PATCH] renames --- dart/lib/src/hub.dart | 8 ++++---- dart/lib/src/hub_adapter.dart | 5 +++-- dart/lib/src/noop_hub.dart | 4 ++-- dart/lib/src/profiling.dart | 10 +++++----- dart/lib/src/sentry_tracer.dart | 4 ++-- dart/test/mocks.dart | 6 +++--- dart/test/mocks.mocks.dart | 30 ++++++++++++++++-------------- flutter/lib/src/profiling.dart | 6 +++--- flutter/test/mocks.mocks.dart | 6 +++--- 9 files changed, 41 insertions(+), 38 deletions(-) diff --git a/dart/lib/src/hub.dart b/dart/lib/src/hub.dart index 2812dfca1e..8c90d4e5cc 100644 --- a/dart/lib/src/hub.dart +++ b/dart/lib/src/hub.dart @@ -452,7 +452,7 @@ class Hub { ); } - Profiler? profiler; + SentryProfiler? profiler; if (_profilerFactory != null && _tracesSampler.sampleProfiling(samplingDecision)) { profiler = _profilerFactory?.startProfiler(transactionContext); @@ -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 diff --git a/dart/lib/src/hub_adapter.dart b/dart/lib/src/hub_adapter.dart index 3fad3b2839..8a9107ae54 100644 --- a/dart/lib/src/hub_adapter.dart +++ b/dart/lib/src/hub_adapter.dart @@ -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; diff --git a/dart/lib/src/noop_hub.dart b/dart/lib/src/noop_hub.dart index fa7bbe84a8..06d31e7da2 100644 --- a/dart/lib/src/noop_hub.dart +++ b/dart/lib/src/noop_hub.dart @@ -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); diff --git a/dart/lib/src/profiling.dart b/dart/lib/src/profiling.dart index 9bce57ffd7..d0ed997313 100644 --- a/dart/lib/src/profiling.dart +++ b/dart/lib/src/profiling.dart @@ -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 finishFor(SentryTransaction transaction); +abstract class SentryProfiler { + Future finishFor(SentryTransaction transaction); void dispose(); } // See https://develop.sentry.dev/sdk/profiles/ @internal -abstract class ProfileInfo { +abstract class SentryProfileInfo { SentryEnvelopeItem asEnvelopeItem(); } diff --git a/dart/lib/src/sentry_tracer.dart b/dart/lib/src/sentry_tracer.dart index 80f1554225..6012a13bfb 100644 --- a/dart/lib/src/sentry_tracer.dart +++ b/dart/lib/src/sentry_tracer.dart @@ -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. diff --git a/dart/test/mocks.dart b/dart/test/mocks.dart index edc3edb211..b5fdd59aa9 100644 --- a/dart/test/mocks.dart +++ b/dart/test/mocks.dart @@ -153,8 +153,8 @@ class MockRateLimiter implements RateLimiter { } @GenerateMocks([ - ProfilerFactory, - Profiler, - ProfileInfo, + SentryProfilerFactory, + SentryProfiler, + SentryProfileInfo, ]) void main() {} diff --git a/dart/test/mocks.mocks.dart b/dart/test/mocks.mocks.dart index 44a1236747..5f2556400e 100644 --- a/dart/test/mocks.mocks.dart +++ b/dart/test/mocks.mocks.dart @@ -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( @@ -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); } diff --git a/flutter/lib/src/profiling.dart b/flutter/lib/src/profiling.dart index e88bcec1e4..2480fb000b 100644 --- a/flutter/lib/src/profiling.dart +++ b/flutter/lib/src/profiling.dart @@ -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; @@ -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; @@ -96,7 +96,7 @@ class NativeProfiler implements Profiler { } // ignore: invalid_use_of_internal_member -class NativeProfileInfo implements ProfileInfo { +class NativeProfileInfo implements SentryProfileInfo { final Map _payload; // ignore: invalid_use_of_internal_member late final List _data = utf8JsonEncoder.convert(_payload); diff --git a/flutter/test/mocks.mocks.dart b/flutter/test/mocks.mocks.dart index ebfc095fda..7e8b1c28ef 100644 --- a/flutter/test/mocks.mocks.dart +++ b/flutter/test/mocks.mocks.dart @@ -219,7 +219,7 @@ 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, @@ -227,7 +227,7 @@ class MockSentryTracer extends _i1.Mock implements _i4.SentryTracer { returnValueForMissingStub: null, ); @override - set profileInfo(_i9.ProfileInfo? _profileInfo) => super.noSuchMethod( + set profileInfo(_i9.SentryProfileInfo? _profileInfo) => super.noSuchMethod( Invocation.setter( #profileInfo, _profileInfo, @@ -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,