-
Notifications
You must be signed in to change notification settings - Fork 764
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
tracing: add record_all!
macro for recording multiple values in one call
#3227
tracing: add record_all!
macro for recording multiple values in one call
#3227
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.
Looks good. Thank you very much!
Just one small change
Currently, Span.record_all() is part of the public API and accepts ValueSet as a parameter. However, constructing a ValueSet is both verbose and undocumented, making it not so practical. To make recording multiple values easier, we introduce a new macro: record_all!, which wraps the Span.record_all() function. As we don't intend anyone to call Span.record_all() directly, we hide it from the documentation. We reference the new macro from Span.record() doc comment instead. The new record_all! macro supports optional formatting sigils % and ?, ensuring a consistent DevEx with the other value-recording macros.
Co-authored-by: Hayden Stainsby <[email protected]>
When developing the test, I realized that the previous iteration would not support plain primitive values, such as integers or booleans. Given that span! macro supports that, I thought it to be reasonable for record_all! to do so as well. This version does. It is also simpler than the original. Looking forward to feedback!
656fc70
to
f80475b
Compare
Rebased against master, to include the lint fixes from #3202. |
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.
Couple of small comments.
Co-authored-by: Hayden Stainsby <[email protected]>
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.
Fantastic, thanks for all your work!
record_all!
macro for recording multiple values in one call
Motivation
Currently, Span.record_all() is part of the public API and accepts ValueSet as a parameter.
However, constructing a ValueSet is both verbose and undocumented, making it not so practical.
Solution
To make recording multiple values easier, we introduce a new macro: record_all!, which wraps the Span.record_all() function. As we don't intend anyone to call Span.record_all() directly, we hide it from the documentation. We reference the new macro from Span.record() doc comment instead.
The new record_all! macro supports optional formatting sigils % and ?, ensuring a consistent DevEx with the other value-recording macros.