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
TracingModality::init()(opens new window) to register
TracingModalityas the global default tracer.
- Note that
TracingModalityrequires a Modality auth token. It will either read one from the default location (
~/.config/modality_cli/.user_auth_token) or you can provide one in an
Optionsstruct (opens new window) and use the
init_with_options()function. (opens new window)
- You may also need to configure the URL where
TracingModalitywill send data. You can do this by setting the server address (opens new window) and using
init_with_options(). (opens new window)
- Note that
- Record trace data with
- Use the
modalityCLI to explore the data you have collected.
modality logis a good place to get started viewing data.
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.interaction.remote_nonce attributes. You can get the timeline ID for a thread with the
timeline_id() function. (opens new window)