From c111d44ae8f2b2cb17ec487be2a956b802253ead Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Thu, 18 Apr 2024 11:01:58 -0800 Subject: [PATCH] fix another build issue --- .../Sentry/Profiling/SentryLaunchProfiling.m | 45 +++++++++++-------- .../SentryTests/SentryLaunchProfiling+Tests.h | 4 +- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/Sources/Sentry/Profiling/SentryLaunchProfiling.m b/Sources/Sentry/Profiling/SentryLaunchProfiling.m index 4df346e303..191a786c5b 100644 --- a/Sources/Sentry/Profiling/SentryLaunchProfiling.m +++ b/Sources/Sentry/Profiling/SentryLaunchProfiling.m @@ -6,7 +6,7 @@ # import "SentryDispatchQueueWrapper.h" # import "SentryFileManager.h" # import "SentryInternalDefines.h" -# import "SentryLaunchProfiling+Tests.h" +# import "SentryLaunchProfiling.h" # import "SentryLog.h" # import "SentryOptions.h" # import "SentryProfiler+Private.h" @@ -23,12 +23,8 @@ NS_ASSUME_NONNULL_BEGIN -NSString *const kSentryLaunchProfileConfigKeyTracesSampleRate = @"traces"; -NSString *const kSentryLaunchProfileConfigKeyProfilesSampleRate = @"profiles"; - # pragma mark - Private -BOOL sentry_isTracingAppLaunch; static SentryTracer *_Nullable sentry_launchTracer; SentryTracerConfiguration * @@ -41,6 +37,17 @@ return config; } +# pragma mark - Package + +typedef struct { + BOOL shouldProfile; + SentrySamplerDecision *_Nullable tracesDecision; + SentrySamplerDecision *_Nullable profilesDecision; +} SentryLaunchProfileConfig; + +NSString *const kSentryLaunchProfileConfigKeyTracesSampleRate = @"traces"; +NSString *const kSentryLaunchProfileConfigKeyProfilesSampleRate = @"profiles"; + SentryLaunchProfileConfig sentry_shouldProfileNextLaunch(SentryOptions *options) { @@ -75,8 +82,23 @@ return (SentryLaunchProfileConfig) { YES, tracesSamplerDecision, profilesSamplerDecision }; } +SentryTransactionContext * +sentry_context(NSNumber *tracesRate) +{ + SentryTransactionContext *context = + [[SentryTransactionContext alloc] initWithName:@"launch" + nameSource:kSentryTransactionNameSourceCustom + operation:@"app.lifecycle" + origin:SentryTraceOriginAutoAppStartProfile + sampled:kSentrySampleDecisionYes]; + context.sampleRate = tracesRate; + return context; +} + # pragma mark - Public +BOOL sentry_isTracingAppLaunch; + void sentry_configureLaunchProfiling(SentryOptions *options) { @@ -97,19 +119,6 @@ }]; } -SentryTransactionContext * -sentry_context(NSNumber *tracesRate) -{ - SentryTransactionContext *context = - [[SentryTransactionContext alloc] initWithName:@"launch" - nameSource:kSentryTransactionNameSourceCustom - operation:@"app.lifecycle" - origin:SentryTraceOriginAutoAppStartProfile - sampled:kSentrySampleDecisionYes]; - context.sampleRate = tracesRate; - return context; -} - void sentry_startLaunchProfile(void) { diff --git a/Tests/SentryTests/SentryLaunchProfiling+Tests.h b/Tests/SentryTests/SentryLaunchProfiling+Tests.h index 06efd17f2e..3dd4556eb1 100644 --- a/Tests/SentryTests/SentryLaunchProfiling+Tests.h +++ b/Tests/SentryTests/SentryLaunchProfiling+Tests.h @@ -15,11 +15,11 @@ typedef struct { SentrySamplerDecision *_Nullable profilesDecision; } SentryLaunchProfileConfig; -SentryLaunchProfileConfig sentry_shouldProfileNextLaunch(SentryOptions *options); - SENTRY_EXTERN NSString *const kSentryLaunchProfileConfigKeyTracesSampleRate; SENTRY_EXTERN NSString *const kSentryLaunchProfileConfigKeyProfilesSampleRate; +SentryLaunchProfileConfig sentry_shouldProfileNextLaunch(SentryOptions *options); + SentryTransactionContext *sentry_context(NSNumber *tracesRate); NS_ASSUME_NONNULL_END