-
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-7421 Expose Crash Plugin #2126
Conversation
8e89ba5
to
cb6d250
Compare
Datadog ReportBranch report: ✅ 0 Failed, 3583 Passed, 0 Skipped, 2m 32.38s Total Time 🔻 Code Coverage Decreases vs Default Branch (7)
|
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.
👌 Everything looks great except the removal of queue
that will cause performance regression (see my other comment).
DDAssertJSONEqual(rumEvent.context!.contextInfo, crashContext.lastRUMAttributes!) | ||
let contextAttributes = try XCTUnwrap(rumEvent.context?.contextInfo) | ||
let lastRUMAttributes = try XCTUnwrap(crashContext.lastRUMAttributes?.attributes) | ||
DDAssertJSONEqual(contextAttributes, lastRUMAttributes.merging(crashReportAttributes) { $1 }) |
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.
🏅
@@ -97,5 +100,6 @@ public struct DDCrashReport: Codable, PassthroughAnyCodable { | |||
self.meta = meta | |||
self.wasTruncated = wasTruncated | |||
self.context = context | |||
self.additionalAttributes = AnyCodable(additionalAttributes) |
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/ Am I correct by saying that Codable
requirement for DDCrashReport
only comes from the message bus interface? We're using PassthroughAnyCodable
so there's no actual coding and perf hit, but things like passing attribtues ☝️ are far from easy.
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.
Exactly, it is only for conformance.
The DDCrashReport
and CrashContext
are now both in DatadogInternal
, so it's no longer required to pass them as FeatureBaggage
. We could pass them directly as a .crash(report: DDCrashReport, context: CrashContext)
message on the bus, but such change has wider impact and should be treated separately IMO.
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.
Looks great 💪
Hello @naftaly 👋 Here is the follow up of your contribution. The 2 main changes are:
I hope this will answer your needs! |
Thank you for your response. I'm curious why you chose to have the user store a block. Approaches like this can easily lead to retain cycles and unexpected behavior. In contrast, a simple send call is more explicit and easier to understand. |
Internally, we make sure that the closure does not retain anything, if the Datadog SDK instance is deallocated, the closure will have no effect. Additionally, the crash-reporting feature is immutable and the closure is only about transmitting the crash report by jumping on a dedicated queue (we've called the message-bus), so the closure is also thread-safe. The reason we went with this approach is that we want a single entry-point for interacting with the crash reporter lib, and that entry-point is the I hope this make sense! |
This reverts commit cb6d250.
2fd49df
to
5005800
Compare
/merge |
/merge |
Devflow running:
|
/merge |
Devflow running:
|
Hi @maxep , I just wanted to validate that you don't expect the completion block to be called on any specific if called in the future by a 3rd party. For example, if I hold onto the block and call it at a later point, it won't be on the internal thanks. |
Hey @naftaly 👋
Exactly, you can hold the |
What and why?
Follow-up #2116
Expose
CrashReportingPlugin
publicly and allow reporting crashes asynchronously with additional attributes.The plugin can also provide an optional backtrace reporter.
How?
Crash Reporting Plugin
The plugin interface is now
public
with@escaping
reporting closure, allowing reporting crashes at any time.The interface also define an optional
backtraceReporter
property for reading backtraces.This new plugin interface allows integration to fully replace the
PLCrashReporter
implementation.Crash Report Additional Attributes
The
DDCrashReport
now definesadditionalAttributes
property to propagate atrributes.These attributes are merged with logs' user attributes and RUM Error's context.
Review checklist
make api-surface
)