-
Notifications
You must be signed in to change notification settings - Fork 140
RUM-9747 Strongly-typed RUM Additional Context #2290
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
Conversation
f9eb92a
to
26c9219
Compare
Datadog ReportBranch report: ✅ 0 Failed, 2397 Passed, 1495 Skipped, 2m 49.52s Total duration (1m 56.05s time saved) |
26c9219
to
43b7028
Compare
cabcd8e
to
77208b0
Compare
64365bd
to
9a71de0
Compare
9a71de0
to
eb6381b
Compare
Datadog Summary✅ Code Quality ✅ Code Security ✅ Dependencies Test Optimization ReportBranch report: ✅ 0 Failed, 2467 Passed, 1421 Skipped, 2m 50.7s Total Time Was this helpful? Give us feedback! |
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.
Overall, it looks good 👍 I left a few questions about the internal API and challenged a couple of design choices 🙂.
/// Gets an additional context value. | ||
/// | ||
/// - Parameter type: The value type. | ||
/// - Parameter type: The additional context type. | ||
/// - Returns: The `Context` if found | ||
public func additionalContext<Context>(ofType type: Context.Type = Context.self) -> Context? where Context: AdditionalContext { | ||
additionalContext[type.key] as? Context | ||
} | ||
|
||
/// Gets an additional context value. | ||
/// - Parameter context: The additional context. | ||
public mutating func set<Context>(additionalContext context: Context?) where Context: AdditionalContext { | ||
additionalContext[Context.key] = 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.
api/ The current API comments are too vague and don't provide any meaningful information beyond what the method names already imply. In particular, the comment for set(additionalContext:)
appears to be incorrect—likely copy-pasted from elsewhere.
Since API comments are currently our primary form of architectural documentation (unfortunately), they warrant careful attention. As a reader, I’d expect the comments to explain key concepts—like what "additional context" actually represents, how to add / update or remove one. Without that, these APIs come across as opaque and disconnected.
To avoid redundancy, this explanation can be centralized in the documentation for the AdditionalContext type itself, and symbol links can be used to reference it from related APIs.
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 indeed, I will add more details there 👍
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 have added more doc with link to core's method to mutate the context, LMKWYT!
|
||
/// Gets an additional context value. | ||
/// - Parameter context: The additional context. | ||
public mutating func set<Context>(additionalContext context: Context?) where Context: AdditionalContext { |
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/ How can additionalContext
be removed after it was previously set? 🤔 💭
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.
By using this method, I can also add a method to the context itself 👍
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.
🎯
/merge |
View all feedbacks in Devflow UI.
The expected merge time in
Tests failed on this commit cd25762: What to do next?
|
/merge |
View all feedbacks in Devflow UI.
The expected merge time in
|
What and why?
Following: #2289
FeatureBaggage
comes with perf implications, we are replacing loosely-typed baggages in core context by strongly-typed additional context.How?
Replace RUM baggage by
RUMCoreContext
as additional context.Review checklist
make api-surface
)