Skip to content

Commit

Permalink
attributes: added missing RecordTypes for instrument (#2781)
Browse files Browse the repository at this point in the history
When using a function annotated with `#[instrument]` it parses the
parameters of the function and records them either using `Value` or
using `std::fmt::Debug`. There were a few types that implement `Value`
but were missing the RecordTypes array. Added them + a unit test for a
single one.

Fixed: #2775
  • Loading branch information
kaffarell authored and davidbarsky committed Oct 2, 2024
1 parent 56fc2e5 commit f03c612
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tracing-attributes/tests/instrument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ fn override_everything() {
fn fields() {
#[instrument(target = "my_target", level = "debug")]
fn my_fn(arg1: usize, arg2: bool, arg3: String) {}
fn my_fn(arg1: usize, arg2: bool, arg3: String) {}

let span = expect::span()
.named("my_fn")
Expand All @@ -69,6 +70,7 @@ fn fields() {
.with_value(&2usize)
.and(expect::field("arg2").with_value(&false))
.and(expect::field("arg3").with_value(&"Cool".to_string()))
.and(expect::field("arg3").with_value(&"Cool".to_string()))
.only(),
),
)
Expand All @@ -81,6 +83,7 @@ fn fields() {
.with_value(&3usize)
.and(expect::field("arg2").with_value(&true))
.and(expect::field("arg3").with_value(&"Still Cool".to_string()))
.and(expect::field("arg3").with_value(&"Still Cool".to_string()))
.only(),
),
)
Expand All @@ -90,7 +93,7 @@ fn fields() {
.only()
.run_with_handle();

with_default(collector, || {
with_default(subscriber, || {
my_fn(2, false, "Cool".to_string());
my_fn(3, true, "Still Cool".to_string());
});
Expand Down

0 comments on commit f03c612

Please sign in to comment.