tracing.rs Library

This library implements a backend for the popular rust tracing framework tracing.rs (opens new window) to directly stream data to Modality. It provides a tracing.rs Layer to process trace data. The library reference documentation can be found here. (opens new window)

# Integration Steps

  1. Add tracing-modality to your cargo.toml dependencies.
  2. Use TracingModality::init() (opens new window) to register TracingModality as the global default tracer.
  3. Record trace data with tracing.rs macros.
  4. Use the modality CLI to explore the data you have collected. modality log is a good place to get started viewing data.

# Concepts

This library was built with multi-threaded applications in mind. As such, it automatically creates a timeline per OS thread in your application. If, when you spawn a thread, you give it a name, that name will automatically be used as the name of the timeline.

To record interactions between timelines, use the special attributes. The library automatically generates a logical time for each event but these logical times are not currently exposed to user code. You should therefore generate a nonce for each interaction and use the event.nonce and event.interaction.remote_nonce attributes. You can get the timeline ID for a thread with the timeline_id() function. (opens new window)

# Reference

See the rust docs (opens new window) for the API reference and more information about how the library interfaces with Modality. Examples can be found in the github repository. (opens new window)