Skip to content

Commit 921529c

Browse files
Revert "feat: Add support for tags and trace context fields for termination watch (getsentry#5561)"
This reverts commit 186f06f.
1 parent 5a85fbb commit 921529c

19 files changed

+363
-211
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
- Improve launch profile configuration management (#5318)
8484
- Deprecate getStoreEndpoint (#5591)
8585
- Record user for watchdog termination events (#5558)
86+
- Add support for dist and environment fields for termination watch (#5560)
8687

8788
## 8.53.1
8889

Sentry.xcodeproj/project.pbxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,7 @@
10271027
F452438A2DE65968003E8F50 /* ExceptionCatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = F45243862DE65968003E8F50 /* ExceptionCatcher.h */; };
10281028
F452438C2DE65BC0003E8F50 /* SentryUseNSExceptionCallstackWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = F452438B2DE65BC0003E8F50 /* SentryUseNSExceptionCallstackWrapper.h */; };
10291029
F458D1132E180BB00028273E /* SentryFileManagerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = F458D1122E180BB00028273E /* SentryFileManagerProtocol.swift */; };
1030+
F458D1152E1869AD0028273E /* SentryScopePersistentStore+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = F458D1142E1869AD0028273E /* SentryScopePersistentStore+String.swift */; };
10301031
F49D41982DEA27AF00D9244E /* SentryUseNSExceptionCallstackWrapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F49D41972DEA27AF00D9244E /* SentryUseNSExceptionCallstackWrapperTests.swift */; };
10311032
F49D419A2DEA2FB000D9244E /* SentryCrashExceptionApplicationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F49D41992DEA2FB000D9244E /* SentryCrashExceptionApplicationTests.swift */; };
10321033
F49D419C2DEA30C300D9244E /* SentryCrashExceptionApplicationHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = F49D419B2DEA30B800D9244E /* SentryCrashExceptionApplicationHelper.h */; };
@@ -2290,6 +2291,7 @@
22902291
F45243872DE65968003E8F50 /* ExceptionCatcher.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExceptionCatcher.m; sourceTree = "<group>"; };
22912292
F452438B2DE65BC0003E8F50 /* SentryUseNSExceptionCallstackWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryUseNSExceptionCallstackWrapper.h; path = include/SentryUseNSExceptionCallstackWrapper.h; sourceTree = "<group>"; };
22922293
F458D1122E180BB00028273E /* SentryFileManagerProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryFileManagerProtocol.swift; sourceTree = "<group>"; };
2294+
F458D1142E1869AD0028273E /* SentryScopePersistentStore+String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SentryScopePersistentStore+String.swift"; sourceTree = "<group>"; };
22932295
F49D41972DEA27AF00D9244E /* SentryUseNSExceptionCallstackWrapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUseNSExceptionCallstackWrapperTests.swift; sourceTree = "<group>"; };
22942296
F49D41992DEA2FB000D9244E /* SentryCrashExceptionApplicationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCrashExceptionApplicationTests.swift; sourceTree = "<group>"; };
22952297
F49D419B2DEA30B800D9244E /* SentryCrashExceptionApplicationHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryCrashExceptionApplicationHelper.h; path = include/SentryCrashExceptionApplicationHelper.h; sourceTree = "<group>"; };
@@ -4039,6 +4041,7 @@
40394041
isa = PBXGroup;
40404042
children = (
40414043
F4E3DCCA2E1579240093CB80 /* SentryScopePersistentStore.swift */,
4044+
F458D1142E1869AD0028273E /* SentryScopePersistentStore+String.swift */,
40424045
);
40434046
path = Persistence;
40444047
sourceTree = "<group>";

Sources/Sentry/SentryWatchdogTerminationScopeObserver.m

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ - (void)setLevel:(enum SentryLevel)level
7979

8080
- (void)setTags:(nullable NSDictionary<NSString *, NSString *> *)tags
8181
{
82-
[self.attributesProcessor setTags:tags];
82+
// Left blank on purpose
8383
}
8484

8585
- (void)setUser:(nullable SentryUser *)user
@@ -89,9 +89,7 @@ - (void)setUser:(nullable SentryUser *)user
8989

9090
- (void)setTraceContext:(nullable NSDictionary<NSString *, id> *)traceContext
9191
{
92-
// Nothing to do here, Trace Context is not persisted for watchdog termination events
93-
// On regular events, we have the current trace in memory, but there isn't time to persist one
94-
// in watchdog termination events
92+
// Left blank on purpose
9593
}
9694

9795
@end

Sources/Sentry/SentryWatchdogTerminationTracker.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ - (void)start
5858
[self addBreadcrumbsToEvent:event];
5959
[self addContextToEvent:event];
6060
event.user = [self.scopePersistentStore readPreviousUserFromDisk];
61+
event.dist = [self.scopePersistentStore readPreviousDistFromDisk];
62+
event.environment = [self.scopePersistentStore readPreviousEnvironmentFromDisk];
6163

6264
SentryException *exception =
6365
[[SentryException alloc] initWithValue:SentryWatchdogTerminationExceptionValue

Sources/Sentry/SentryWatchdogTerminationTrackingIntegration.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ - (BOOL)installWithOptions:(SentryOptions *)options
9797
// before installation.
9898
[scopeObserver setContext:outerScope.contextDictionary];
9999
[scopeObserver setUser:outerScope.userObject];
100+
[scopeObserver setEnvironment:outerScope.environmentString];
101+
[scopeObserver setDist:outerScope.distString];
100102
}];
101103

102104
return YES;

Sources/Swift/Integrations/WatchdogTerminations/Processors/SentryWatchdogTerminationAttributesProcessor.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ import Foundation
3636
}
3737
}
3838

39+
public func setDist(_ dist: String?) {
40+
setData(data: dist, field: .dist) { [weak self] data in
41+
self?.scopePersistentStore.writeDistToDisk(dist: data)
42+
}
43+
}
44+
45+
public func setEnvironment(_ environment: String?) {
46+
setData(data: environment, field: .environment) { [weak self] data in
47+
self?.scopePersistentStore.writeEnvironmentToDisk(environment: data)
48+
}
49+
}
50+
3951
// MARK: - Private
4052
private func setData<T>(data: T?, field: SentryScopeField, save: @escaping (T) -> Void) {
4153
SentrySDKLog.debug("Setting \(field.name) in background queue: \(String(describing: data))")

Sources/Swift/Persistence/SentryScopePersistentStore+Context.swift

Lines changed: 0 additions & 11 deletions
This file was deleted.

Sources/Swift/Persistence/SentryScopePersistentStore+Helper.swift

Lines changed: 0 additions & 55 deletions
This file was deleted.

Sources/Swift/Persistence/SentryScopePersistentStore+Tags.swift

Lines changed: 0 additions & 11 deletions
This file was deleted.

Sources/Swift/Persistence/SentryScopePersistentStore+User.swift

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)