-
-
Notifications
You must be signed in to change notification settings - Fork 368
ref: Convert SentryWatchdogTerminationScopeObserver to Swift #6469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 0 additions & 52 deletions
52
Sources/Sentry/include/SentryWatchdogTerminationScopeObserver.h
This file was deleted.
Oops, something went wrong.
73 changes: 73 additions & 0 deletions
73
Sources/Swift/Integrations/Session/SentryWatchdogTerminationScopeObserver.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.