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

Allow setting with_span_events on the tracing Layer #353

Open
RemiBardon opened this issue Jan 6, 2025 · 4 comments · May be fixed by #356
Open

Allow setting with_span_events on the tracing Layer #353

RemiBardon opened this issue Jan 6, 2025 · 4 comments · May be fixed by #356
Assignees
Labels
enhancement Improvement of existing features or bugfix k::api Related to API (application interface) question Further information is requested
Milestone

Comments

@RemiBardon
Copy link

I'd like to set .with_span_events(FmtSpan::NEW | FmtSpan::CLOSE) on the tracing Layer when running Cucumber, but there is no API for it. I have tried plenty of workarounds, but I always get duplicated, unordered or missing logs. Could you please provide an API for customizing your tracing Layer?

RemiBardon added a commit to prose-im/prose-pod-api that referenced this issue Jan 7, 2025
@tyranron tyranron self-assigned this Jan 20, 2025
@tyranron tyranron added enhancement Improvement of existing features or bugfix question Further information is requested k::api Related to API (application interface) labels Jan 20, 2025
@tyranron
Copy link
Member

@RemiBardon could you elaborate more on this? It's hard for me to understand why .configure_and_init_tracing() doesn't solve your problem, given that you're free to do pretty much everything with the fmt_layer passed to the closure?

@RemiBardon
Copy link
Author

RemiBardon commented Jan 20, 2025

@tyranron fmt_layer is not a Layer, it's a Layered, which means it doesn't have the with_span_events function. Your library doesn't expose a way to access this function on the non-Layered Layer (which is what I need).

@tyranron
Copy link
Member

tyranron commented Jan 20, 2025

@RemiBardon actually, the struct Layered implements the Layer trait. However, you're referring to the fmt::Layer struct and its method, not the Layer trait. I see... and you want to access the initialized fmt::layer() directly to tweak it. Layered::downcast_ref() won't be much help here too, because the required methods have the self receiver, and we don't have Layered::downcast_mut() to mem::swap() it in any way too.

Ok. I will play with possible API extensions to support it and will ask your opinion on it. Thanks for making this clear!

@RemiBardon
Copy link
Author

@tyranron Oh yes sorry I was on my phone I tried to remember my previous explorations. Thank you for looking into it!

@tyranron tyranron linked a pull request Jan 20, 2025 that will close this issue
3 tasks
@tyranron tyranron added this to the 0.22.0 milestone Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of existing features or bugfix k::api Related to API (application interface) question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants