Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 10 additions & 8 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
0A2D8DA9289BC905008720F6 /* SentryViewHierarchyProviderHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A2D8DA7289BC905008720F6 /* SentryViewHierarchyProviderHelper.m */; };
0A5370A128A3EC2400B2DCDE /* SentryViewHierarchyProviderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A5370A028A3EC2400B2DCDE /* SentryViewHierarchyProviderTests.swift */; };
0A56DA5F28ABA01B00C400D5 /* SentryTransactionContext+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A56DA5E28ABA01B00C400D5 /* SentryTransactionContext+Private.h */; };
0A80E433291017C300095219 /* SentryWatchdogTerminationScopeObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A80E432291017C300095219 /* SentryWatchdogTerminationScopeObserver.m */; };
0A80E435291017D500095219 /* SentryWatchdogTerminationScopeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A80E434291017D500095219 /* SentryWatchdogTerminationScopeObserver.h */; };
0A94158228F6C4C2006A5DD1 /* SentryAppStateManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A94158128F6C4C2006A5DD1 /* SentryAppStateManagerTests.swift */; };
0A9415BA28F96CAC006A5DD1 /* TestSentryReachability.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9415B928F96CAC006A5DD1 /* TestSentryReachability.swift */; };
0A9BF4E228A114940068D266 /* SentryViewHierarchyIntegration.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A9BF4E128A114940068D266 /* SentryViewHierarchyIntegration.m */; };
Expand Down Expand Up @@ -1113,6 +1111,8 @@
FAAB95D82EA1E23F0030A2DB /* SentryExtraContextProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAAB95D22EA1E23A0030A2DB /* SentryExtraContextProvider.swift */; };
FAAB95DE2EA1EB470030A2DB /* SentryDeviceContextKeys.h in Headers */ = {isa = PBXBuildFile; fileRef = FAAB95DD2EA1EB470030A2DB /* SentryDeviceContextKeys.h */; };
FAAB96132EA31FA20030A2DB /* SentryDebugImageProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAAB96122EA31F9E0030A2DB /* SentryDebugImageProvider.swift */; };
FAAB967B2EA6D82F0030A2DB /* SentryWatchdogTerminationScopeObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAAB96752EA6D8280030A2DB /* SentryWatchdogTerminationScopeObserver.swift */; };
FAAB967E2EA6D9D80030A2DB /* SentryCrashScopeHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = FAAB967D2EA6D9D70030A2DB /* SentryCrashScopeHelper.m */; };
FAB007362E9EF8D3001C806A /* SentryUIViewControllerPerformanceTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAB007302E9EF8CB001C806A /* SentryUIViewControllerPerformanceTracker.swift */; };
FAB007432E9F47E8001C806A /* SessionTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAB007422E9F47E4001C806A /* SessionTracker.swift */; };
FAB007522E9FE2FF001C806A /* SentrySwizzleWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAB0074C2E9FE2FA001C806A /* SentrySwizzleWrapper.swift */; };
Expand Down Expand Up @@ -1295,8 +1295,6 @@
0A2D8DA7289BC905008720F6 /* SentryViewHierarchyProviderHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryViewHierarchyProviderHelper.m; sourceTree = "<group>"; };
0A5370A028A3EC2400B2DCDE /* SentryViewHierarchyProviderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryViewHierarchyProviderTests.swift; sourceTree = "<group>"; };
0A56DA5E28ABA01B00C400D5 /* SentryTransactionContext+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentryTransactionContext+Private.h"; path = "include/SentryTransactionContext+Private.h"; sourceTree = "<group>"; };
0A80E432291017C300095219 /* SentryWatchdogTerminationScopeObserver.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryWatchdogTerminationScopeObserver.m; sourceTree = "<group>"; };
0A80E434291017D500095219 /* SentryWatchdogTerminationScopeObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryWatchdogTerminationScopeObserver.h; path = include/SentryWatchdogTerminationScopeObserver.h; sourceTree = "<group>"; };
0A94158128F6C4C2006A5DD1 /* SentryAppStateManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryAppStateManagerTests.swift; sourceTree = "<group>"; };
0A9415B928F96CAC006A5DD1 /* TestSentryReachability.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestSentryReachability.swift; sourceTree = "<group>"; };
0A9BF4E128A114940068D266 /* SentryViewHierarchyIntegration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryViewHierarchyIntegration.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2475,6 +2473,9 @@
FAAB95D22EA1E23A0030A2DB /* SentryExtraContextProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryExtraContextProvider.swift; sourceTree = "<group>"; };
FAAB95DD2EA1EB470030A2DB /* SentryDeviceContextKeys.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryDeviceContextKeys.h; path = include/SentryDeviceContextKeys.h; sourceTree = "<group>"; };
FAAB96122EA31F9E0030A2DB /* SentryDebugImageProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryDebugImageProvider.swift; sourceTree = "<group>"; };
FAAB96752EA6D8280030A2DB /* SentryWatchdogTerminationScopeObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryWatchdogTerminationScopeObserver.swift; sourceTree = "<group>"; };
FAAB967C2EA6D9C00030A2DB /* SentryCrashScopeHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SentryCrashScopeHelper.h; sourceTree = "<group>"; };
FAAB967D2EA6D9D70030A2DB /* SentryCrashScopeHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryCrashScopeHelper.m; sourceTree = "<group>"; };
FAB007302E9EF8CB001C806A /* SentryUIViewControllerPerformanceTracker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUIViewControllerPerformanceTracker.swift; sourceTree = "<group>"; };
FAB007422E9F47E4001C806A /* SessionTracker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionTracker.swift; sourceTree = "<group>"; };
FAB0074C2E9FE2FA001C806A /* SentrySwizzleWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySwizzleWrapper.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3654,8 +3655,6 @@
7B6C5F8626034395007F7DFF /* SentryWatchdogTerminationLogic.m */,
7B98D7CA25FB64EC00C5A389 /* SentryWatchdogTerminationTrackingIntegration.h */,
7B98D7CE25FB650F00C5A389 /* SentryWatchdogTerminationTrackingIntegration.m */,
0A80E434291017D500095219 /* SentryWatchdogTerminationScopeObserver.h */,
0A80E432291017C300095219 /* SentryWatchdogTerminationScopeObserver.m */,
D452FC512DDB4AF100AFF56F /* Processors */,
);
name = WatchdogTerminations;
Expand Down Expand Up @@ -3796,6 +3795,8 @@
isa = PBXGroup;
children = (
7B965727268321CD00C66E25 /* SentryCrashScopeObserverTests.swift */,
FAAB967C2EA6D9C00030A2DB /* SentryCrashScopeHelper.h */,
FAAB967D2EA6D9D70030A2DB /* SentryCrashScopeHelper.m */,
7B6ADFCE26A02CAE0076C206 /* SentryCrashReportTests.swift */,
7BD337E324A356180050DB6E /* SentryCrashIntegrationTests.swift */,
7B4E23AE2519E13800060D68 /* SentryCrashIntegration+TestInit.h */,
Expand Down Expand Up @@ -4980,6 +4981,7 @@
FAB0073C2E9F47DE001C806A /* Session */ = {
isa = PBXGroup;
children = (
FAAB96752EA6D8280030A2DB /* SentryWatchdogTerminationScopeObserver.swift */,
FAB007422E9F47E4001C806A /* SessionTracker.swift */,
);
path = Session;
Expand Down Expand Up @@ -5274,7 +5276,6 @@
7B42C48027E08F33009B58C2 /* SentryDependencyContainer.h in Headers */,
6334314120AD9AE40077E581 /* SentryMechanism.h in Headers */,
03F84D2827DD414C008FE43F /* SentryCPU.h in Headers */,
0A80E435291017D500095219 /* SentryWatchdogTerminationScopeObserver.h in Headers */,
843FB3242D0CD04D00558F18 /* SentryUserAccess.h in Headers */,
7B610D642512399600B0B5D9 /* SentryHub+Private.h in Headers */,
D8F6A24B2885515C00320515 /* SentryPredicateDescriptor.h in Headers */,
Expand Down Expand Up @@ -5826,7 +5827,6 @@
84A8891D28DBD28900C51DFD /* SentryDevice.m in Sources */,
7B56D73324616D9500B842DA /* SentryConcurrentRateLimitsDictionary.m in Sources */,
8ECC674825C23A20000E2BF6 /* SentryTransaction.m in Sources */,
0A80E433291017C300095219 /* SentryWatchdogTerminationScopeObserver.m in Sources */,
D8CAC02E2BA0663E00E38F34 /* SentryReplayOptions.swift in Sources */,
7BECF42826145CD900D9826E /* SentryMechanismMeta.m in Sources */,
8E7C982F2693D56000E6336C /* SentryTraceHeader.m in Sources */,
Expand Down Expand Up @@ -5949,6 +5949,7 @@
84AF45A729A7FFA500FBB177 /* SentryProfiledTracerConcurrency.mm in Sources */,
7DC8310C2398283C0043DD9A /* SentryCrashIntegration.m in Sources */,
D45CE9752E5F454E00BFEDB2 /* SentryScreenshotSource.swift in Sources */,
FAAB967B2EA6D82F0030A2DB /* SentryWatchdogTerminationScopeObserver.swift in Sources */,
FAE579BA2E7DBE9900B710F9 /* SentryGlobalEventProcessor.swift in Sources */,
03F84D3227DD4191008FE43F /* SentryProfiler.mm in Sources */,
635B3F391EBC6E2500A6176D /* SentryAsynchronousOperation.m in Sources */,
Expand Down Expand Up @@ -6285,6 +6286,7 @@
0A2D7BBA29152CBF008727AF /* SentryWatchdogTerminationScopeObserverTests.swift in Sources */,
7BD4BD4B27EB2DC20071F4FF /* SentryDiscardedEventTests.swift in Sources */,
63FE721A20DA66EC00CDBAE8 /* SentryCrashSysCtl_Tests.m in Sources */,
FAAB967E2EA6D9D80030A2DB /* SentryCrashScopeHelper.m in Sources */,
F46E0BA82E6A19F900DAA75C /* SentryCrashWrapperTests.swift in Sources */,
7B88F30424BC8E6500ADF90A /* SentrySerializationTests.swift in Sources */,
843FB3432D156B9900558F18 /* SentryFeedbackTests.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#import "SentryWatchdogTerminationBreadcrumbProcessor.h"
#import "SentryDependencyContainer.h"
#import "SentryInternalDefines.h"
#import "SentryLogC.h"
#import "SentrySerialization.h"
Expand All @@ -17,6 +18,12 @@ @interface SentryWatchdogTerminationBreadcrumbProcessor ()

@implementation SentryWatchdogTerminationBreadcrumbProcessor

- (instancetype)initWithMaxBreadcrumbs:(NSInteger)maxBreadcrumbs
{
return [self initWithMaxBreadcrumbs:maxBreadcrumbs
fileManager:SentryDependencyContainer.sharedInstance.fileManager];
}

- (instancetype)initWithMaxBreadcrumbs:(NSInteger)maxBreadcrumbs
fileManager:(SentryFileManager *_Nullable)fileManager
{
Expand Down
7 changes: 2 additions & 5 deletions Sources/Sentry/SentryDependencyContainer.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#import <SentrySDK+Private.h>
#import <SentrySwift.h>
#import <SentryTracer.h>
#import <SentryWatchdogTerminationScopeObserver.h>

#if SENTRY_HAS_UIKIT
# import "SentryANRTrackerV2.h"
Expand Down Expand Up @@ -402,10 +401,8 @@ - (SentryDebugImageProvider *)debugImageProvider SENTRY_THREAD_SANITIZER_DOUBLE_
// This method is only a factory, therefore do not keep a reference.
// The scope observer will be created each time it is needed.
return [[SentryWatchdogTerminationScopeObserver alloc]
initWithBreadcrumbProcessor:[[SentryWatchdogTerminationBreadcrumbProcessor alloc]
initWithMaxBreadcrumbs:options.maxBreadcrumbs
fileManager:self.fileManager]
attributesProcessor:self.watchdogTerminationAttributesProcessor];
initWithMaxBreadcrumbs:options.maxBreadcrumbs
attributesProcessor:self.watchdogTerminationAttributesProcessor];
}

- (SentryWatchdogTerminationAttributesProcessor *)
Expand Down
98 changes: 0 additions & 98 deletions Sources/Sentry/SentryWatchdogTerminationScopeObserver.m

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# import <SentrySwift.h>
# import <SentryWatchdogTerminationBreadcrumbProcessor.h>
# import <SentryWatchdogTerminationLogic.h>
# import <SentryWatchdogTerminationScopeObserver.h>
# import <SentryWatchdogTerminationTracker.h>
NS_ASSUME_NONNULL_BEGIN

Expand Down
1 change: 1 addition & 0 deletions Sources/Sentry/include/SentryPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@
#import "SentryTraceOrigin.h"
#import "SentryTraceProfiler.h"
#import "SentryUser+Serialize.h"
#import "SentryWatchdogTerminationBreadcrumbProcessor.h"
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ NS_ASSUME_NONNULL_BEGIN

@interface SentryWatchdogTerminationBreadcrumbProcessor : NSObject

- (instancetype)initWithMaxBreadcrumbs:(NSInteger)maxBreadcrumbs;

- (instancetype)initWithMaxBreadcrumbs:(NSInteger)maxBreadcrumbs
fileManager:(SentryFileManager *_Nullable)fileManager;

Expand Down
52 changes: 0 additions & 52 deletions Sources/Sentry/include/SentryWatchdogTerminationScopeObserver.h

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
@_implementationOnly import _SentryPrivate

/**
* This scope observer is used by the Watchdog Termination integration to write breadcrumbs to disk.
* The overhead is ~0.015 seconds for 1000 breadcrumbs.
* This class doesn't need to be thread safe as the scope already calls the scope observers in a
* thread safe manner.
*/
@_spi(Private) @objc public class SentryWatchdogTerminationScopeObserver: NSObject, SentryScopeObserver {

private let breadcrumbProcessor: SentryWatchdogTerminationBreadcrumbProcessor
private let attributesProcessor: SentryWatchdogTerminationAttributesProcessor

init(breadcrumbProcessor: SentryWatchdogTerminationBreadcrumbProcessor, attributesProcessor: SentryWatchdogTerminationAttributesProcessor) {
self.breadcrumbProcessor = breadcrumbProcessor
self.attributesProcessor = attributesProcessor
}

@objc public convenience init(maxBreadcrumbs: Int, attributesProcessor: SentryWatchdogTerminationAttributesProcessor) {
self.init(breadcrumbProcessor: SentryWatchdogTerminationBreadcrumbProcessor(maxBreadcrumbs: maxBreadcrumbs), attributesProcessor: attributesProcessor)
}

public func setUser(_ user: User?) {
attributesProcessor.setUser(user)
}

public func setTags(_ tags: [String: String]?) {
attributesProcessor.setTags(tags)
}

public func setExtras(_ extras: [String: Any]?) {
attributesProcessor.setExtras(extras)
}

public func setContext(_ context: [String: [String: Any]]?) {
attributesProcessor.setContext(context)
}

public func setTraceContext(_ traceContext: [String: Any]?) {
// Nothing to do here, Trace Context is not persisted for watchdog termination events
// On regular events, we have the current trace in memory, but there isn't time to persist one
// in watchdog termination events
}

public func setDist(_ dist: String?) {
attributesProcessor.setDist(dist)
}

public func setEnvironment(_ environment: String?) {
attributesProcessor.setEnvironment(environment)
}

public func setFingerprint(_ fingerprint: [String]?) {
attributesProcessor.setFingerprint(fingerprint)
}

public func setLevel(_ level: SentryLevel) {
// Nothing to do here, watchdog termination events are always Fatal
}

public func addSerializedBreadcrumb(_ serializedBreadcrumb: [String: Any]) {
breadcrumbProcessor.addSerializedBreadcrumb(serializedBreadcrumb)
}

public func clearBreadcrumbs() {
breadcrumbProcessor.clearBreadcrumbs()
}

public func clear() {
breadcrumbProcessor.clear()
attributesProcessor.clear()
}
}
2 changes: 1 addition & 1 deletion Sources/Swift/State/SentryScopeObserver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
func setUser(_ user: User?)
func setTags(_ tags: [String: String]?)
func setExtras(_ extras: [String: Any]?)
func setContext(_ context: [String: Any]?)
func setContext(_ context: [String: [String: Any]]?)
func setTraceContext(_ traceContext: [String: Any]?)
func setDist(_ dist: String?)
func setEnvironment(_ environment: String?)
Expand Down
Loading
Loading