-
Notifications
You must be signed in to change notification settings - Fork 135
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-638 Global RUM attributes #232
Conversation
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.
Few comments added 👌. Also, before we merge it, let's discuss with the team the precise product requirements for global attributes processing.
df30050
to
6c0a492
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.
Just fix the variable name thing, then we can merge 👌
Sources/Datadog/RUMMonitor.swift
Outdated
// MARK: - Private | ||
|
||
private func aggregate(_ localAttributes: [AttributeKey: AttributeValue]?) -> [AttributeKey: AttributeValue] { | ||
var mergedAttributes = queue.sync { return self.RUMAttributes } |
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.
Ref, I created RUMM-691 Add RUMMonitor benchmarks
so we can test if there's no performance drop due to this extra thread switch for every public API call.
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.
i think the cost should be negligible but if we have concerns, we can do that:
protocol RUMCommand {
var attributes { get set }
...
}
class RUMMonitor {
func process(cmd) {
queue.async {
cmd.attributes.merge(globalAttrs)
appScope.process(cmd)
}
}
then we won't need queue.sync
to get global attrs
let me know if you need this
6c0a492
to
a5480b1
Compare
What and why?
Users may want to use common attributes in their RUM events
We should provide them a convenient way to set those attributes
How?
Now users can add, update or remove global attributes in their
RUMMonitor
instancesNote:
attributes
is thread-safeReview checklist