-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
We are using the tracing crate to emit tracing/log events, which allows us to define "spans" that events happen in. This can make it easier for users to correlate events that are linked, e.g. all the events that happen within a single insert_one call.
Users can instrument driver API calls themselves like:
let res = coll .insert_one(doc! {"x" : 1 }, None) .instrument(debug_span!("insert_one_span")) .await;
Which will put all of the events the emitted as part of the call to insert_one within insert_one_span. Spans can also be nested, so any span created by e.g. tokio within there could be nested in that span.
However, we could also define our own spans for intervals of interest within the driver, for example the execution of a single command. This could allow a user instrumenting an API call to easily identify if the call above involved a retry, since there would be two "command" spans within the insert_one span.
While coming up with our plan for spans and introducing and testing them is not necessarily in scope for the logging spec implementation this would be nice add-on work to do once we have all of our events in place.
- related to
-
RUST-580 Easier Debugging with Standardized Logging: logging specification
- Closed