-
Notifications
You must be signed in to change notification settings - Fork 134
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
RUM-5176 [CP] Allow reporting RUM error in sync #2180
base: develop
Are you sure you want to change the base?
Conversation
9f9f963
to
ab9a5a4
Compare
Datadog ReportBranch report: ✅ 0 Failed, 930 Passed, 2819 Skipped, 53.72s Total duration (1m 37.66s time saved) |
ab9a5a4
to
4cc5952
Compare
4cc5952
to
cdd9251
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job. Just some questions
@@ -78,6 +78,9 @@ - (void)testDDRUMMonitorAPI { | |||
[monitor addAttributeForKey:@"" value:@""]; | |||
[monitor addFeatureFlagEvaluationWithName: @"name" value: @"value"]; | |||
|
|||
[monitor _internal_sync_addError:[NSError errorWithDomain:NSCocoaErrorDomain code:-100 userInfo:nil] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Can you create a mock out of this error? It will also adds meaning to it
/// No-op completion function. | ||
/// | ||
/// Using a function prevent allocating a closure when applying a placeholder. | ||
public func NOPCompletionHandler() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Why is a NOP completion handler needed to avoid optionality? It’s common to encounter optional completion handlers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done! 🙌 And nice PR description.
} | ||
|
||
extension RUMMonitorProtocol { | ||
/// It cannot be declared '@_spi' without a default implementation in a protocol extension | ||
func addViewLoadingTime(overwrite: Bool) { | ||
// no-op | ||
} | ||
|
||
/// It cannot be declared '@_spi' without a default implementation in a protocol extension |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😮
Co-authored-by: Marie Denis <[email protected]>
What and why?
Cross-platform SDKs can report fatal errors before the native process crashes. However, RUM and the Core execute processing and write asynchronously, and the crash can suspend these executions, leading to the loss of the cross-platform error information.
We should let cross-platform SDKs to report error in sync, blocking the caller-thread.
How?
The change involve changes at different layers:
Core module
Add
completion
argument toWriter
interface. The completion callback is called when the data is written to disk.RUM Module
Add
completionHandler
property toRUMErrorCommand
. TheRUMViewScope
calls the completion handler after writing the error event and the view update.The RUM Monitor now expose a method to report an error with a completion handler, The method is exposed using the
@_spi(Internal)
attribute.Objc Module
The
DDRUMMonitor
now expose a_internal_sync_addError
to report an error in sync. This method will wait for the underlying completion handler to be called before returning.Review checklist
make api-surface
)