-
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
RUMM-2334 Use DatadogContext in V1 scopes #981
Conversation
683c8c4
to
144c192
Compare
Datadog ReportBranch report: ✅ |
c4c7c66
to
05775fa
Compare
var networkConnectionInfo: NetworkConnectionInfo = .unknown | ||
var networkConnectionInfo: NetworkConnectionInfo? |
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.
Making this optional to keep previous behavior.
d275f69
to
b135773
Compare
c058c91
to
db2072a
Compare
queue.async { | ||
let transformedCommand = self.transform(command: command) | ||
core.v1.scope(for: RUMFeature.self)?.eventWriteContext { context, writer in | ||
self.queue.sync { |
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.
All 3 Features now perform sync
on the event write context. This is not set in stone, and I'm exploring ways of synchronising Features with the shared context.
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.
👍 Just submitted my review on that 🙂. Definitely, we need to explore the impact of this in high load situations. I'll think of possible solutions as well.
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 in overall 👌. I feel that the V1Context
layer we added now pays off in this migration 🙌.
The main concern I have is about performing queue.sync {}
in Features, but I believe this is exactly the topic we're now exploring, right?
queue.sync { | ||
self.queue.sync { |
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.
@maxep Does lack of queue.async {}
here correspond to Features context synchronisation issue we've been debating about?
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.
Yes! still exploring solution. It will be change in future PR.
init(context: DatadogContext) { | ||
self.init(device: context.device) | ||
} | ||
|
||
init(context: DatadogV1Context) { | ||
self.init(device: context.device) | ||
} |
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.
We need both because of V1 context leftover in Crash Reporting, right?
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.
Yes.. crash reporting and web view tracking. Both integration are still using v1 context
attributes: .concurrent | ||
qos: .utility |
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.
Given it is serial now, it no longer makes sense to do .barrier
in following code, no?
func write(block: @escaping (inout DatadogContext) -> Void) {
queue.async(flags: .barrier)
}
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.
Indeed, .barrier
will have no effect on the serial queue, but I would like to keep it for now and move back to concurrency with a better threading design later.
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.
Got it 👌. Good to go as it is targeting feature branch 👍
What and why?
While working on Feature communication through Core Context, I realised that we cannot apply synchronisation while maintaining 2 contexts. It is time to fade away
DatadogV1Context
in favor ofDatadogContext
.How?
Date Provider
The
DateProvider
is no longer part of context, it is now injected as part of the configuration, the goal is to let feature create a timestamp outside of the Event Write Context. The configuration will be revisited when doing the split.Persisting
DatadogV1Context
UsageDatadogV1Context
still exists for Crash-Reporting and WebView-Tracking integrations which do not use the Event Write Context.Review checklist
Custom CI job configuration (optional)