diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e02e70b013..0cf255edf6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Crash due to a background call to -[UIApplication applicationState] (#3855) - Save framework without UIKit/AppKit as Github Asset for releases (#3858) +- Fix crash associated with runtime collision in global C function names (#3862) ## 8.24.0 diff --git a/Sentry.xcodeproj/project.pbxproj b/Sentry.xcodeproj/project.pbxproj index 0c0e65967af..714ff6a32ab 100644 --- a/Sentry.xcodeproj/project.pbxproj +++ b/Sentry.xcodeproj/project.pbxproj @@ -1857,9 +1857,9 @@ D8751FA4274743710032F4DE /* SentryNSURLSessionTaskSearchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryNSURLSessionTaskSearchTests.swift; sourceTree = ""; }; D8757D142A209F7300BFEFCC /* SentrySampleDecision+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentrySampleDecision+Private.h"; path = "include/SentrySampleDecision+Private.h"; sourceTree = ""; }; D875ED0A276CC84700422FAC /* SentryNSDataTrackerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SentryNSDataTrackerTests.swift; sourceTree = ""; }; + D878C6C02BC8048A0039D6A3 /* SentryPrivate.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = SentryPrivate.podspec; sourceTree = ""; }; D87C89022BC43C9C0086C7DF /* SentryRedactOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryRedactOptions.swift; sourceTree = ""; }; D87C892A2BC67BC20086C7DF /* SentryExperimentalOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryExperimentalOptions.swift; sourceTree = ""; }; - D878C6C02BC8048A0039D6A3 /* SentryPrivate.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = SentryPrivate.podspec; sourceTree = ""; }; D880E3A628573E87008A90DB /* SentryBaggageTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryBaggageTests.swift; sourceTree = ""; }; D880E3B02860A5A0008A90DB /* SentryEvent+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentryEvent+Private.h"; path = "include/SentryEvent+Private.h"; sourceTree = ""; }; D884A20327C80F2700074664 /* SentryCoreDataTrackerTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCoreDataTrackerTest.swift; sourceTree = ""; }; @@ -4325,7 +4325,6 @@ 7BCFBD6F2681D0EE00BC27D8 /* SentryCrashScopeObserver.m in Sources */, 7BD86ED1264A7CF6005439DB /* SentryAppStartMeasurement.m in Sources */, 7DC27EC723997EB7006998B5 /* SentryAutoBreadcrumbTrackingIntegration.m in Sources */, - D820CE142BB2F13C00BA339D /* SentryCoreGraphicsHelper.m in Sources */, 63FE717B20DA4C1100CDBAE8 /* SentryCrashReport.c in Sources */, 7B7A599726B692F00060A676 /* SentryScreenFrames.m in Sources */, 7B3398652459C15200BD9C96 /* SentryEnvelopeRateLimit.m in Sources */, diff --git a/Sources/Sentry/Profiling/SentryLaunchProfiling.m b/Sources/Sentry/Profiling/SentryLaunchProfiling.m index 8fbf006db56..191a786c5b8 100644 --- a/Sources/Sentry/Profiling/SentryLaunchProfiling.m +++ b/Sources/Sentry/Profiling/SentryLaunchProfiling.m @@ -6,6 +6,7 @@ # import "SentryDispatchQueueWrapper.h" # import "SentryFileManager.h" # import "SentryInternalDefines.h" +# import "SentryLaunchProfiling.h" # import "SentryLog.h" # import "SentryOptions.h" # import "SentryProfiler+Private.h" @@ -22,21 +23,33 @@ NS_ASSUME_NONNULL_BEGIN -BOOL isTracingAppLaunch; -NSString *const kSentryLaunchProfileConfigKeyTracesSampleRate = @"traces"; -NSString *const kSentryLaunchProfileConfigKeyProfilesSampleRate = @"profiles"; -static SentryTracer *_Nullable launchTracer; - # pragma mark - Private +static SentryTracer *_Nullable sentry_launchTracer; + +SentryTracerConfiguration * +sentry_config(NSNumber *profilesRate) +{ + SentryTracerConfiguration *config = [SentryTracerConfiguration defaultConfiguration]; + config.profilesSamplerDecision = + [[SentrySamplerDecision alloc] initWithDecision:kSentrySampleDecisionYes + forSampleRate:profilesRate]; + 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 -shouldProfileNextLaunch(SentryOptions *options) +sentry_shouldProfileNextLaunch(SentryOptions *options) { BOOL shouldProfileNextLaunch = options.enableAppLaunchProfiling && options.enableTracing; if (!shouldProfileNextLaunch) { @@ -52,14 +65,14 @@ SentrySamplingContext *context = [[SentrySamplingContext alloc] initWithTransactionContext:transactionContext]; - SentrySamplerDecision *tracesSamplerDecision = sampleTrace(context, options); + SentrySamplerDecision *tracesSamplerDecision = sentry_sampleTrace(context, options); if (tracesSamplerDecision.decision != kSentrySampleDecisionYes) { SENTRY_LOG_DEBUG(@"Sampling out the launch trace."); return (SentryLaunchProfileConfig) { NO, nil, nil }; } SentrySamplerDecision *profilesSamplerDecision - = sampleProfile(context, tracesSamplerDecision, options); + = sentry_sampleProfile(context, tracesSamplerDecision, options); if (profilesSamplerDecision.decision != kSentrySampleDecisionYes) { SENTRY_LOG_DEBUG(@"Sampling out the launch profile."); return (SentryLaunchProfileConfig) { NO, nil, nil }; @@ -69,13 +82,28 @@ 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 -configureLaunchProfiling(SentryOptions *options) +sentry_configureLaunchProfiling(SentryOptions *options) { [SentryDependencyContainer.sharedInstance.dispatchQueueWrapper dispatchAsyncWithBlock:^{ - SentryLaunchProfileConfig config = shouldProfileNextLaunch(options); + SentryLaunchProfileConfig config = sentry_shouldProfileNextLaunch(options); if (!config.shouldProfile) { removeAppLaunchProfilingConfigFile(); return; @@ -91,31 +119,8 @@ }]; } -SentryTransactionContext * -context(NSNumber *tracesRate) -{ - SentryTransactionContext *context = - [[SentryTransactionContext alloc] initWithName:@"launch" - nameSource:kSentryTransactionNameSourceCustom - operation:@"app.lifecycle" - origin:SentryTraceOriginAutoAppStartProfile - sampled:kSentrySampleDecisionYes]; - context.sampleRate = tracesRate; - return context; -} - -SentryTracerConfiguration * -config(NSNumber *profilesRate) -{ - SentryTracerConfiguration *config = [SentryTracerConfiguration defaultConfiguration]; - config.profilesSamplerDecision = - [[SentrySamplerDecision alloc] initWithDecision:kSentrySampleDecisionYes - forSampleRate:profilesRate]; - return config; -} - void -startLaunchProfile(void) +sentry_startLaunchProfile(void) { static dispatch_once_t onceToken; @@ -123,8 +128,8 @@ // directly to customers, and we'll want to ensure it only runs once. dispatch_once is an // efficient operation so it's fine to leave this in the launch path in any case. dispatch_once(&onceToken, ^{ - isTracingAppLaunch = appLaunchProfileConfigFileExists(); - if (!isTracingAppLaunch) { + sentry_isTracingAppLaunch = appLaunchProfileConfigFileExists(); + if (!sentry_isTracingAppLaunch) { return; } @@ -145,29 +150,30 @@ } SENTRY_LOG_INFO(@"Starting app launch profile at %llu.", getAbsoluteTime()); - launchTracer = [[SentryTracer alloc] initWithTransactionContext:context(tracesRate) - hub:nil - configuration:config(profilesRate)]; + sentry_launchTracer = + [[SentryTracer alloc] initWithTransactionContext:sentry_context(tracesRate) + hub:nil + configuration:sentry_config(profilesRate)]; }); } void -stopAndTransmitLaunchProfile(SentryHub *hub) +sentry_stopAndTransmitLaunchProfile(SentryHub *hub) { - if (launchTracer == nil) { + if (sentry_launchTracer == nil) { SENTRY_LOG_DEBUG(@"No launch tracer present to stop."); return; } - launchTracer.hub = hub; - stopAndDiscardLaunchProfileTracer(); + sentry_launchTracer.hub = hub; + sentry_stopAndDiscardLaunchProfileTracer(); } void -stopAndDiscardLaunchProfileTracer(void) +sentry_stopAndDiscardLaunchProfileTracer(void) { SENTRY_LOG_DEBUG(@"Finishing launch tracer."); - [launchTracer finish]; + [sentry_launchTracer finish]; } NS_ASSUME_NONNULL_END diff --git a/Sources/Sentry/SentryHub.m b/Sources/Sentry/SentryHub.m index 81be5ef1355..d5628492a22 100644 --- a/Sources/Sentry/SentryHub.m +++ b/Sources/Sentry/SentryHub.m @@ -400,14 +400,14 @@ - (SentryTracer *)startTransactionWithContext:(SentryTransactionContext *)transa customSamplingContext:customSamplingContext]; SentrySamplerDecision *tracesSamplerDecision - = sampleTrace(samplingContext, self.client.options); + = sentry_sampleTrace(samplingContext, self.client.options); transactionContext = [self transactionContext:transactionContext withSampled:tracesSamplerDecision.decision]; transactionContext.sampleRate = tracesSamplerDecision.sampleRate; #if SENTRY_TARGET_PROFILING_SUPPORTED SentrySamplerDecision *profilesSamplerDecision - = sampleProfile(samplingContext, tracesSamplerDecision, self.client.options); + = sentry_sampleProfile(samplingContext, tracesSamplerDecision, self.client.options); configuration.profilesSamplerDecision = profilesSamplerDecision; #endif // SENTRY_TARGET_PROFILING_SUPPORTED" diff --git a/Sources/Sentry/SentryProfiler.mm b/Sources/Sentry/SentryProfiler.mm index 1bea79f08fe..7fa4e95544d 100644 --- a/Sources/Sentry/SentryProfiler.mm +++ b/Sources/Sentry/SentryProfiler.mm @@ -436,7 +436,7 @@ + (nullable SentryEnvelopeItem *)createEnvelopeItemForProfilePayload: } NSString *pathToWrite; - if (isTracingAppLaunch) { + if (sentry_isTracingAppLaunch) { SENTRY_LOG_DEBUG(@"Writing app launch profile."); pathToWrite = [appSupportDirPath stringByAppendingPathComponent:@"launchProfile"]; } else { @@ -448,11 +448,11 @@ + (nullable SentryEnvelopeItem *)createEnvelopeItemForProfilePayload: SENTRY_LOG_DEBUG(@"Already a %@ profile file present; make sure to remove them right after " @"using them, and that tests clean state in between so there isn't " @"leftover config producing one when it isn't expected.", - isTracingAppLaunch ? @" launch" : @""); + sentry_isTracingAppLaunch ? @" launch" : @""); return; } - SENTRY_LOG_DEBUG(@"Writing%@ profile to file.", isTracingAppLaunch ? @" launch" : @""); + SENTRY_LOG_DEBUG(@"Writing%@ profile to file.", sentry_isTracingAppLaunch ? @" launch" : @""); NSError *error; if (![data writeToFile:pathToWrite options:NSDataWritingAtomic error:&error]) { diff --git a/Sources/Sentry/SentrySDK.m b/Sources/Sentry/SentrySDK.m index 00bd559ab23..fbb530586c8 100644 --- a/Sources/Sentry/SentrySDK.m +++ b/Sources/Sentry/SentrySDK.m @@ -235,9 +235,9 @@ + (void)startWithOptions:(SentryOptions *)options if (shouldstopAndTransmitLaunchProfile) { SENTRY_LOG_DEBUG(@"Stopping launch profile in SentrySDK.start because there will " @"be no automatic trace to attach it to."); - stopAndTransmitLaunchProfile(hub); + sentry_stopAndTransmitLaunchProfile(hub); } - configureLaunchProfiling(options); + sentry_configureLaunchProfiling(options); }]; #endif // SENTRY_TARGET_PROFILING_SUPPORTED }]; diff --git a/Sources/Sentry/SentrySampling.m b/Sources/Sentry/SentrySampling.m index a0eda6170b2..c3283aca595 100644 --- a/Sources/Sentry/SentrySampling.m +++ b/Sources/Sentry/SentrySampling.m @@ -55,7 +55,7 @@ #pragma mark - Public SentrySamplerDecision * -sampleTrace(SentrySamplingContext *context, SentryOptions *options) +sentry_sampleTrace(SentrySamplingContext *context, SentryOptions *options) { // check this transaction's sampling decision, if already decided if (context.transactionContext.sampled != kSentrySampleDecisionUndecided) { @@ -83,7 +83,7 @@ #if SENTRY_TARGET_PROFILING_SUPPORTED SentrySamplerDecision * -sampleProfile(SentrySamplingContext *context, SentrySamplerDecision *tracesSamplerDecision, +sentry_sampleProfile(SentrySamplingContext *context, SentrySamplerDecision *tracesSamplerDecision, SentryOptions *options) { // Profiles are always undersampled with respect to traces. If the trace is not sampled, diff --git a/Sources/Sentry/SentryTimeToDisplayTracker.m b/Sources/Sentry/SentryTimeToDisplayTracker.m index 53157a01567..930ccd44bae 100644 --- a/Sources/Sentry/SentryTimeToDisplayTracker.m +++ b/Sources/Sentry/SentryTimeToDisplayTracker.m @@ -134,7 +134,7 @@ - (void)framesTrackerHasNewFrame:(NSDate *)newFrameDate if (!_waitForFullDisplay) { [SentryDependencyContainer.sharedInstance.framesTracker removeListener:self]; # if SENTRY_TARGET_PROFILING_SUPPORTED - stopAndDiscardLaunchProfileTracer(); + sentry_stopAndDiscardLaunchProfileTracer(); # endif // SENTRY_TARGET_PROFILING_SUPPORTED } } @@ -144,7 +144,7 @@ - (void)framesTrackerHasNewFrame:(NSDate *)newFrameDate self.fullDisplaySpan.timestamp = newFrameDate; [self.fullDisplaySpan finish]; # if SENTRY_TARGET_PROFILING_SUPPORTED - stopAndDiscardLaunchProfileTracer(); + sentry_stopAndDiscardLaunchProfileTracer(); # endif // SENTRY_TARGET_PROFILING_SUPPORTED } diff --git a/Sources/Sentry/SentryTracer.m b/Sources/Sentry/SentryTracer.m index d63d93d3209..91e9add850c 100644 --- a/Sources/Sentry/SentryTracer.m +++ b/Sources/Sentry/SentryTracer.m @@ -115,7 +115,7 @@ @implementation SentryTracer { #if SENTRY_TARGET_PROFILING_SUPPORTED + (void)load { - startLaunchProfile(); + sentry_startLaunchProfile(); } #endif // SENTRY_TARGET_PROFILING_SUPPORTED @@ -190,7 +190,7 @@ - (instancetype)initWithTransactionContext:(SentryTransactionContext *)transacti #if SENTRY_TARGET_PROFILING_SUPPORTED if (_configuration.profilesSamplerDecision.decision == kSentrySampleDecisionYes - || isTracingAppLaunch) { + || sentry_isTracingAppLaunch) { _internalID = [[SentryId alloc] init]; if ((_isProfiling = [SentryProfiler startWithTracer:_internalID])) { SENTRY_LOG_DEBUG(@"Started profiler for trace %@ with internal id %@", diff --git a/Sources/Sentry/include/SentryLaunchProfiling.h b/Sources/Sentry/include/SentryLaunchProfiling.h index 7158dc38434..e52d21320a1 100644 --- a/Sources/Sentry/include/SentryLaunchProfiling.h +++ b/Sources/Sentry/include/SentryLaunchProfiling.h @@ -1,9 +1,10 @@ -#import "SentryDefines.h" #import "SentryProfilingConditionals.h" -#import #if SENTRY_TARGET_PROFILING_SUPPORTED +# import "SentryDefines.h" +# import + @class SentryHub; @class SentryId; @class SentryOptions; @@ -12,23 +13,23 @@ NS_ASSUME_NONNULL_BEGIN -SENTRY_EXTERN BOOL isTracingAppLaunch; +SENTRY_EXTERN BOOL sentry_isTracingAppLaunch; /** Try to start a profiled trace for this app launch, if the configuration allows. */ -SENTRY_EXTERN void startLaunchProfile(void); +void sentry_startLaunchProfile(void); /** * Stop any profiled trace that may be in flight from the start of the app launch, and transmit the * dedicated transaction with the profiling data attached. */ -void stopAndTransmitLaunchProfile(SentryHub *hub); +void sentry_stopAndTransmitLaunchProfile(SentryHub *hub); /** * Stop the tracer that started the launch profiler. Use when the profiler will be attached to an * app start transaction and doesn't need to be attached to a dedicated tracer. The tracer managing * the profiler will be discarded in this case. */ -void stopAndDiscardLaunchProfileTracer(void); +void sentry_stopAndDiscardLaunchProfileTracer(void); /** * Write a file to disk containing sample rates for profiles and traces. The presence of this file @@ -36,7 +37,7 @@ void stopAndDiscardLaunchProfileTracer(void); * thread sampling decisions through to SentryHub later when it needs to start a transaction for the * profile to be attached to. */ -void configureLaunchProfiling(SentryOptions *options); +void sentry_configureLaunchProfiling(SentryOptions *options); NS_ASSUME_NONNULL_END diff --git a/Sources/Sentry/include/SentrySampling.h b/Sources/Sentry/include/SentrySampling.h index 5c404b91131..cfec57c459c 100644 --- a/Sources/Sentry/include/SentrySampling.h +++ b/Sources/Sentry/include/SentrySampling.h @@ -1,3 +1,4 @@ +#import "SentryDefines.h" #import "SentryProfilingConditionals.h" #import @@ -10,14 +11,15 @@ NS_ASSUME_NONNULL_BEGIN /** * Determines whether a trace should be sampled based on the context and options. */ -SentrySamplerDecision *sampleTrace(SentrySamplingContext *context, SentryOptions *options); +SENTRY_EXTERN SentrySamplerDecision *sentry_sampleTrace( + SentrySamplingContext *context, SentryOptions *options); #if SENTRY_TARGET_PROFILING_SUPPORTED /** * Determines whether a profile should be sampled based on the context, options, and * whether the trace corresponding to the profile was sampled. */ -SentrySamplerDecision *sampleProfile(SentrySamplingContext *context, +SENTRY_EXTERN SentrySamplerDecision *sentry_sampleProfile(SentrySamplingContext *context, SentrySamplerDecision *tracesSamplerDecision, SentryOptions *options); #endif // SENTRY_TARGET_PROFILING_SUPPORTED diff --git a/Tests/SentryProfilerTests/SentryAppLaunchProfilingTests.m b/Tests/SentryProfilerTests/SentryAppLaunchProfilingTests.m index 45270a23cb9..1c91feea199 100644 --- a/Tests/SentryProfilerTests/SentryAppLaunchProfilingTests.m +++ b/Tests/SentryProfilerTests/SentryAppLaunchProfilingTests.m @@ -16,7 +16,7 @@ @implementation SentryAppLaunchProfilingTests - (void)testLaunchProfileTransactionContext { - SentryTransactionContext *actualContext = context(@1); + SentryTransactionContext *actualContext = sentry_context(@1); XCTAssertEqual(actualContext.nameSource, kSentryTransactionNameSourceCustom); XCTAssert([actualContext.origin isEqualToString:SentryTraceOriginAutoAppStartProfile]); XCTAssert(actualContext.sampled); @@ -28,14 +28,15 @@ - (void)testLaunchProfileTransactionContext - (void)testDefaultOptionsDoNotEnableLaunchProfiling { - XCTAssertFalse(shouldProfileNextLaunch([self defaultOptionsWithOverrides:nil]).shouldProfile, + XCTAssertFalse( + sentry_shouldProfileNextLaunch([self defaultOptionsWithOverrides:nil]).shouldProfile, @"Default options should not enable launch profiling"); } - (void)testAppLaunchProfilingNotSufficientToEnableLaunchProfiling { XCTAssertFalse( - shouldProfileNextLaunch( + sentry_shouldProfileNextLaunch( [self defaultOptionsWithOverrides:@{ SENTRY_OPTION(enableAppLaunchProfiling, @YES) }]) .shouldProfile, @"Default options with only launch profiling option set is not sufficient to enable launch " @@ -45,7 +46,7 @@ - (void)testAppLaunchProfilingNotSufficientToEnableLaunchProfiling - (void)testAppLaunchProfilingAndTracingOptionsNotSufficientToEnableAppLaunchProfiling { XCTAssertFalse( - shouldProfileNextLaunch( + sentry_shouldProfileNextLaunch( [self defaultOptionsWithOverrides:@{ SENTRY_OPTION(enableAppLaunchProfiling, @YES), SENTRY_OPTION(enableTracing, @YES) }]) .shouldProfile, @@ -57,7 +58,7 @@ - (void)testAppLaunchProfilingAndTracingOptionsNotSufficientToEnableAppLaunchPro testAppLaunchProfilingAndTracingAndTracesSampleRateOptionsNotSufficientToEnableAppLaunchProfiling { XCTAssertFalse( - shouldProfileNextLaunch( + sentry_shouldProfileNextLaunch( [self defaultOptionsWithOverrides:@{ SENTRY_OPTION(enableAppLaunchProfiling, @YES), SENTRY_OPTION(enableTracing, @YES), SENTRY_OPTION(tracesSampleRate, @1) }]) @@ -68,7 +69,7 @@ - (void)testAppLaunchProfilingAndTracingOptionsNotSufficientToEnableAppLaunchPro - (void)testMinimumOptionsRequiredToEnableAppLaunchProfiling { - XCTAssert(shouldProfileNextLaunch([self defaultLaunchProfilingOptionsWithOverrides:nil]) + XCTAssert(sentry_shouldProfileNextLaunch([self defaultLaunchProfilingOptionsWithOverrides:nil]) .shouldProfile, @"Default options with app launch profiling and tracing enabled and traces and profiles " @"sample rates of 1 should enable launch profiling"); @@ -77,7 +78,7 @@ - (void)testMinimumOptionsRequiredToEnableAppLaunchProfiling - (void)testDisablingLaunchProfilingOptionDisablesAppLaunchProfiling { XCTAssertFalse( - shouldProfileNextLaunch( + sentry_shouldProfileNextLaunch( [self defaultLaunchProfilingOptionsWithOverrides:@{ SENTRY_OPTION( enableAppLaunchProfiling, @NO) }]) .shouldProfile, @@ -87,7 +88,7 @@ - (void)testDisablingLaunchProfilingOptionDisablesAppLaunchProfiling - (void)testDisablingTracingOptionDisablesAppLaunchProfiling { - XCTAssertFalse(shouldProfileNextLaunch( + XCTAssertFalse(sentry_shouldProfileNextLaunch( [self defaultLaunchProfilingOptionsWithOverrides:@{ SENTRY_OPTION( enableTracing, @NO) }]) .shouldProfile, @@ -98,7 +99,7 @@ - (void)testDisablingTracingOptionDisablesAppLaunchProfiling - (void)testSettingTracesSampleRateTo0DisablesAppLaunchProfiling { XCTAssertFalse( - shouldProfileNextLaunch( + sentry_shouldProfileNextLaunch( [self defaultLaunchProfilingOptionsWithOverrides:@{ SENTRY_OPTION( tracesSampleRate, @0) }]) .shouldProfile, @@ -109,7 +110,7 @@ - (void)testSettingTracesSampleRateTo0DisablesAppLaunchProfiling - (void)testSettingProfilesSampleRateTo0DisablesAppLaunchProfiling { XCTAssertFalse( - shouldProfileNextLaunch( + sentry_shouldProfileNextLaunch( [self defaultLaunchProfilingOptionsWithOverrides:@{ SENTRY_OPTION( profilesSampleRate, @0) }]) .shouldProfile, diff --git a/Tests/SentryTests/SentryLaunchProfiling+Tests.h b/Tests/SentryTests/SentryLaunchProfiling+Tests.h index c4f1ba31d6c..3dd4556eb19 100644 --- a/Tests/SentryTests/SentryLaunchProfiling+Tests.h +++ b/Tests/SentryTests/SentryLaunchProfiling+Tests.h @@ -1,8 +1,9 @@ -#import "SentryDefines.h" #import "SentryLaunchProfiling.h" #if SENTRY_TARGET_PROFILING_SUPPORTED +# import "SentryDefines.h" + @class SentrySamplerDecision; @class SentryOptions; @@ -14,13 +15,12 @@ typedef struct { SentrySamplerDecision *_Nullable profilesDecision; } SentryLaunchProfileConfig; -SENTRY_EXTERN SentryLaunchProfileConfig shouldProfileNextLaunch(SentryOptions *options); - SENTRY_EXTERN NSString *const kSentryLaunchProfileConfigKeyTracesSampleRate; SENTRY_EXTERN NSString *const kSentryLaunchProfileConfigKeyProfilesSampleRate; -SENTRY_EXTERN SentryTransactionContext *context(NSNumber *tracesRate); -SENTRY_EXTERN SentryTracerConfiguration *config(NSNumber *profilesRate); +SentryLaunchProfileConfig sentry_shouldProfileNextLaunch(SentryOptions *options); + +SentryTransactionContext *sentry_context(NSNumber *tracesRate); NS_ASSUME_NONNULL_END