You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to set http.status_code to empty in order to be able to record the value later the most convenient way to do this would be with the macro.
This was implemented in #672. However, it has yet to be released as that PR also causes instrument to reject unrecognized input that it did not previously reject, which we think may constitute a breaking change (#773 (comment)). Stay tuned, though --- I'm planning on trying to make some additional changes to make that change backwards compatible.
@hawkw awesome thanks for the update. Would this also allow for declaring the value on that field in the macro to be tracing::field::Empty? I suppose I can always just put another dummy value but being able to use Empty would more clearly communicate my intent.
Edit: I should have read through the linked comments first it looks like you are working through arbitrary expressions etc.
Currently, field names with no value in instrument are mapped to tracing::field::Empty, which is what that PR does as well, for backwards-compatibility (although you will also be able to use Empty explicitly as well when #672 is published) . However, in tracing-attributes 0.2, we want to change this so that instrument supports the same local variable shorthand as the function-like tracing macros, so you will need to use Empty explicitly instead, the same as all the other macros.
# 0.1.9 (July 8, 2020)
### Added
- Support for arbitrary expressions as fields in `#[instrument]` (#672)
### Changed
- `#[instrument]` now emits a compiler warning when ignoring
unrecognized input (#672, #786)
Fixes#785
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Feature Request
Motivation
I would like to set http.status_code to empty in order to be able to record the value later the most convenient way to do this would be with the macro.
Proposal
Allow
#[tracing::instrument(fields(http.status_code = ...))]
Alternatives
Allow recording of fields without declaring them upfront.
The text was updated successfully, but these errors were encountered: