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

Rework span completion to support adding props #173

Merged
merged 7 commits into from
Dec 9, 2024
Merged

Conversation

KodrAus
Copy link
Contributor

@KodrAus KodrAus commented Dec 8, 2024

Closes #166
Closes #167

This PR reworks the SpanGuard type to not rely on the props type P on its resulting span. This means we can change P while the span executes, such as by pushing properties to it, without needing to rewrite its completion function.

I've also made span completion take &mut self, so you can use guards and do manual completion as well as automatic result completion without them conflicting.

@KodrAus
Copy link
Contributor Author

KodrAus commented Dec 9, 2024

Passing guard by ref mut is going to be an issue for pushing properties to a guard; we need to take it by-value to make that work, but taking by-value means you can't protect against early returns.

@KodrAus KodrAus marked this pull request as ready for review December 9, 2024 09:26
@KodrAus KodrAus merged commit 86e188d into main Dec 9, 2024
48 checks passed
@KodrAus KodrAus deleted the feat/span-completion branch December 9, 2024 10:15
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.

Replace #[span(guard)] with start_span!() #[span(guard)] is incompatible with #[span(ok_lvl/err_lvl/err)]
1 participant