Skip to main content

traceable

Attribute Macro traceable 

Source
#[traceable]
Expand description

Add tracing instrumentation to an async or sync function.

Wraps the function body in a tracing::info_span! with the function name and parameter values recorded as span fields. Async functions use tracing::Instrument for correct span propagation.

§Attributes

  • name = "..." — override the span name (defaults to the function name)
  • skip = "a,b" — comma-separated list of parameter names to exclude from the span

§Example

use synaptic_macros::traceable;

#[traceable]
async fn process_data(input: String, count: usize) -> String {
    format!("{}: {}", input, count)
}

#[traceable(name = "custom_span", skip = "secret")]
async fn with_secret(query: String, secret: String) -> String {
    format!("Processing: {}", query)
}