Skip to content
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

Implement %ret special parameter for using in #[instrument(fields())] #3190

Open
codingskynet opened this issue Jan 13, 2025 · 0 comments
Open

Comments

@codingskynet
Copy link

codingskynet commented Jan 13, 2025

Feature Request

Crates

tracing

Motivation

tracing supports recording returned value by #[instrument(ret)]. But, I think that it is useful that returned value is used in fields arguments. For example, #[instrument(fields(processed_returned = func(%ret))] like adding field based on the function argument.

Proposal

I proposed adding new reserved keyword for returned value like %ret for fields. It can be used for calculating new field from the returned value.

Alternatives

Now, it can be done by manual recoding like Span::current().record("new_field", func(&returned_value)); before returning value.

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

No branches or pull requests

1 participant