Skip to content

Conversation

@matildasmeds
Copy link
Contributor

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.

@matildasmeds matildasmeds requested review from a team, davidbarsky and hawkw as code owners March 11, 2025 19:02
Copy link
Contributor

@hds hds left a 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

matildasmeds and others added 4 commits March 25, 2025 07:07
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!
@matildasmeds matildasmeds force-pushed the matildasmeds/wrap-record-all-call-in-macro branch from 656fc70 to f80475b Compare March 25, 2025 06:14
@matildasmeds
Copy link
Contributor Author

Rebased against master, to include the lint fixes from #3202.

Copy link
Contributor

@hds hds left a 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.

Copy link
Contributor

@hds hds left a 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!

@hds hds changed the title Add record_all! macro for recording multiple values in one call tracing: add record_all! macro for recording multiple values in one call Mar 27, 2025
@hds hds merged commit d6505ca into tokio-rs:master Mar 27, 2025
55 checks passed
@hds hds mentioned this pull request May 21, 2025
25 tasks
hds added a commit that referenced this pull request May 27, 2025
… call (#3227)

## 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.

Co-authored-by: Hayden Stainsby <[email protected]>
hds added a commit that referenced this pull request Jun 3, 2025
… call (#3227)

## 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.

Co-authored-by: Hayden Stainsby <[email protected]>
hds added a commit that referenced this pull request Nov 26, 2025
# 0.1.42 (November 26, 2025)

### Added

- **attributes**: Support constant expressions as instrument field names ([#3158])
- Add `record_all!` macro for recording multiple values in one call ([#3227])
- **core**: Improve code generation at trace points significantly ([#3398])

### Changed

- `tracing-core`: updated to 0.1.35 ([#3414])
- `tracing-attributes`: updated to 0.1.31 ([#3417])

### Fixed

- Fix "name / parent" variant of `event!` ([#2983])
- Remove 'r#' prefix from raw identifiers in field names ([#3130])
- Fix perf regression when `release_max_level_*` not set ([#3373])
- Use imported instead of fully qualified path ([#3374])
- Make `valueset` macro sanitary ([#3382])

### Documented

- **core**: Add missing `dyn` keyword in `Visit` documentation code sample ([#3387])

[#2983]: https://github.com/tokio-rs/tracing/pull/#2983
[#3130]: https://github.com/tokio-rs/tracing/pull/#3130
[#3158]: https://github.com/tokio-rs/tracing/pull/#3158
[#3227]: https://github.com/tokio-rs/tracing/pull/#3227
[#3373]: https://github.com/tokio-rs/tracing/pull/#3373
[#3374]: https://github.com/tokio-rs/tracing/pull/#3374
[#3382]: https://github.com/tokio-rs/tracing/pull/#3382
[#3387]: https://github.com/tokio-rs/tracing/pull/#3387
[#3398]: https://github.com/tokio-rs/tracing/pull/#3398
[#3414]: https://github.com/tokio-rs/tracing/pull/#3414
[#3417]: https://github.com/tokio-rs/tracing/pull/#3417
hds added a commit that referenced this pull request Nov 26, 2025
# 0.1.42 (November 26, 2025)

### Important

The [`Span::record_all`] method has been removed from the documented API. It
was always unsuable via the documented API as it requried a `ValueSet` which
has no publically documented constructors. The method remains, but should not
be used outside of `tracing` macros.

### Added

- **attributes**: Support constant expressions as instrument field names ([#3158])
- Add `record_all!` macro for recording multiple values in one call ([#3227])
- **core**: Improve code generation at trace points significantly ([#3398])

### Changed

- `tracing-core`: updated to 0.1.35 ([#3414])
- `tracing-attributes`: updated to 0.1.31 ([#3417])

### Fixed

- Fix "name / parent" variant of `event!` ([#2983])
- Remove 'r#' prefix from raw identifiers in field names ([#3130])
- Fix perf regression when `release_max_level_*` not set ([#3373])
- Use imported instead of fully qualified path ([#3374])
- Make `valueset` macro sanitary ([#3382])

### Documented

- **core**: Add missing `dyn` keyword in `Visit` documentation code sample ([#3387])

[#2983]: https://github.com/tokio-rs/tracing/pull/#2983
[#3130]: https://github.com/tokio-rs/tracing/pull/#3130
[#3158]: https://github.com/tokio-rs/tracing/pull/#3158
[#3227]: https://github.com/tokio-rs/tracing/pull/#3227
[#3373]: https://github.com/tokio-rs/tracing/pull/#3373
[#3374]: https://github.com/tokio-rs/tracing/pull/#3374
[#3382]: https://github.com/tokio-rs/tracing/pull/#3382
[#3387]: https://github.com/tokio-rs/tracing/pull/#3387
[#3398]: https://github.com/tokio-rs/tracing/pull/#3398
[#3414]: https://github.com/tokio-rs/tracing/pull/#3414
[#3417]: https://github.com/tokio-rs/tracing/pull/#3417
[`Span::record_all`]: https://docs.rs/tracing/0.1.41/tracing/struct.Span.html#method.record_all
hds added a commit that referenced this pull request Nov 26, 2025
# 0.1.42 (November 26, 2025)

### Important

The [`Span::record_all`] method has been removed from the documented API. It
was always unsuable via the documented API as it requried a `ValueSet` which
has no publically documented constructors. The method remains, but should not
be used outside of `tracing` macros.

### Added

- **attributes**: Support constant expressions as instrument field names ([#3158])
- Add `record_all!` macro for recording multiple values in one call ([#3227])
- **core**: Improve code generation at trace points significantly ([#3398])

### Changed

- `tracing-core`: updated to 0.1.35 ([#3414])
- `tracing-attributes`: updated to 0.1.31 ([#3417])

### Fixed

- Fix "name / parent" variant of `event!` ([#2983])
- Remove 'r#' prefix from raw identifiers in field names ([#3130])
- Fix perf regression when `release_max_level_*` not set ([#3373])
- Use imported instead of fully qualified path ([#3374])
- Make `valueset` macro sanitary ([#3382])

### Documented

- **core**: Add missing `dyn` keyword in `Visit` documentation code sample ([#3387])

[#2983]: https://github.com/tokio-rs/tracing/pull/#2983
[#3130]: https://github.com/tokio-rs/tracing/pull/#3130
[#3158]: https://github.com/tokio-rs/tracing/pull/#3158
[#3227]: https://github.com/tokio-rs/tracing/pull/#3227
[#3373]: https://github.com/tokio-rs/tracing/pull/#3373
[#3374]: https://github.com/tokio-rs/tracing/pull/#3374
[#3382]: https://github.com/tokio-rs/tracing/pull/#3382
[#3387]: https://github.com/tokio-rs/tracing/pull/#3387
[#3398]: https://github.com/tokio-rs/tracing/pull/#3398
[#3414]: https://github.com/tokio-rs/tracing/pull/#3414
[#3417]: https://github.com/tokio-rs/tracing/pull/#3417
[`Span::record_all`]: https://docs.rs/tracing/0.1.41/tracing/struct.Span.html#method.record_all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants