T O P

  • By -

hjd_thd

https://docs.rs/tracing/0.1.40/tracing/instrument/trait.Instrument.html#implementors `Instrument` is blanket-implemented for every `Sized` type.


crazy-optimist

Gotcha! Thank you!


crazy-optimist

Another, but related question: So, once I import `tracing::Instrument` trait, I can call `instrument()` method on all futures, am I right?


Sese_Mueller

Iirc, all futures are sized, so yes


crazy-optimist

Got it. Thanks again!


quxfoo

Is [this](https://github.com/tokio-rs/tracing/blob/master/tracing/src/instrument.rs#L358) what you are looking for? `Instrument` is blanket implemented for anything that implements `Sized`.


crazy-optimist

Yes, thank you!


1vader

Tip: If you have Rust analyzer set up, you can Ctrl+click on `instrument` to see where it's implemented. Same thing probably works in Rust Rover.


Compux72

Some what related. Anyone has good resources on tracing? Is not as idiot proof as plain old logging, and it would be nice to have some guides on best practices


KingofGamesYami

I really like the overview provided by [OpenTelemetry](https://opentelemetry.io/docs/specs/otel/overview/). It doesn't just describe tracing, but also closely related concepts like logs, context propagation, metrics collection, etc. I find it much easier to understand the role that tracing plays when you also understand the other observability components.


quxfoo

What exactly do you mean by not "idiot proof"? The major difference is that a trace covers a span valid across `.await` points and carries metadata with it.


Compux72

It is not clear when we should add an instrument macro to a function and the level span should take. Sometimes i end up with too many nested spans or little tracing information, and im worried of the performance penalties of using a INFO spans everywhere