Skip to content

Conversation

seyyed-dev
Copy link
Contributor

Currently, when tracing::field::Empty is used with span.record() calls, the recorded values are lost and not displayed in span traces. This PR introduces on_record functionality to preserve and display recorded values.

let lazy = span!(Level::DEBUG, "lazy span", work_units = Empty);
lazy.record("work_units", &3);
lazy.in_scope(|| {
    info!("doing some work");
});
drop(lazy);

Before

1:main└─┐open: deferred::lazy span 
1:main  ├─ INFO deferred doing some work
1:main ┌┘close(v): deferred::lazy span 

After

1:main└─┐open: deferred::lazy span work_units=3
1:main  ├─ INFO deferred doing some work
1:main ┌┘close(v): deferred::lazy span work_units=3

@seyyed-dev
Copy link
Contributor Author

seyyed-dev commented Sep 16, 2025

If you review commit by commit, you can see the effect of on_record

@seyyed-dev
Copy link
Contributor Author

Clippy errors of the main branch are fixed at #90

@seyyed-dev seyyed-dev force-pushed the main branch 3 times, most recently from 21df80c to 04a547c Compare September 21, 2025 17:02
@oli-obk
Copy link
Collaborator

oli-obk commented Sep 23, 2025

Good catch, thank you! and thanks for the CI fixes in separate PRs

@oli-obk oli-obk merged commit 0f4d5bd into davidbarsky:main Sep 23, 2025
4 checks passed
@oli-obk
Copy link
Collaborator

oli-obk commented Sep 23, 2025

published as 0.4.1

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