macro_rules! make_request_spanner {
($fn:ident($name:literal, $level:expr)) => { ... };
($fn:ident($name:literal, $level:expr, $($fields:tt)*)) => { ... };
}Expand description
Declares fn function compatible with MakeSpan using provided parameters
§Span fields
Following fields are declared when span is created:
http.methodhttp.urlhttp.request_id- Inherited from request ‘X-Request-Id’ or random uuidhttp.user_agent- Only populated if user agent header is presenthttp.versionhttp.headers- Optional. Populated if more than 1 header specified via layer configprotocol- Eitherhttporgrpcdepending oncontent-typehttp.client.ip- Optionally added if IP extractor is specified via layer confighttp.status_code- Semantics of this code depends onprotocolerror.message- Populated withDisplaycontent of the error, returned by underlying service, after processing request.
§Usage
use tower_http_tracing::make_request_spanner;
make_request_spanner!(make_my_request_span("my_request", tracing::Level::INFO));
make_request_spanner!(make_my_service_request_span("my_request", tracing::Level::INFO, service_name = "<your name>"));
let span = make_my_request_span();
span.record("http.url", "I can override span field");