mirror of
https://github.com/tokio-rs/axum.git
synced 2024-11-21 14:46:32 +01:00
Update axum prometheus-metrics example (#2516)
Co-authored-by: Dudin.Roman <Roman@HPROMAN>
This commit is contained in:
parent
dd3ff101e2
commit
94901e0fe7
2 changed files with 4 additions and 4 deletions
|
@ -6,8 +6,8 @@ publish = false
|
|||
|
||||
[dependencies]
|
||||
axum = { path = "../../axum" }
|
||||
metrics = "0.18"
|
||||
metrics-exporter-prometheus = "0.8"
|
||||
metrics = { version = "0.22", default-features = false }
|
||||
metrics-exporter-prometheus = { version = "0.13", default-features = false }
|
||||
tokio = { version = "1.0", features = ["full"] }
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
|
|
|
@ -110,8 +110,8 @@ async fn track_metrics(req: Request, next: Next) -> impl IntoResponse {
|
|||
("status", status),
|
||||
];
|
||||
|
||||
metrics::increment_counter!("http_requests_total", &labels);
|
||||
metrics::histogram!("http_requests_duration_seconds", latency, &labels);
|
||||
metrics::counter!("http_requests_total", &labels).increment(1);
|
||||
metrics::histogram!("http_requests_duration_seconds", &labels).record(latency);
|
||||
|
||||
response
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue