tower_http_metrics/server/
mod.rs

1use http::Method;
2
3pub use self::layer::HttpServerMetricsLayer;
4pub use self::service::HttpServerMetricsService;
5
6mod body;
7mod future;
8mod layer;
9mod service;
10
11/// Utility function that maps methods to a *limited* set of strings to
12/// prevent too many metrics time-series from being created.
13pub(crate) const fn label_from_method(method: &Method) -> &'static str {
14    match *method {
15        Method::CONNECT => "CONNECT",
16        Method::DELETE => "DELETE",
17        Method::GET => "GET",
18        Method::HEAD => "HEAD",
19        Method::OPTIONS => "OPTIONS",
20        Method::PATCH => "PATCH",
21        Method::POST => "POST",
22        Method::PUT => "PUT",
23        Method::TRACE => "TRACE",
24        _ => "",
25    }
26}