1
- pub use axum:: { Matcher , AXUM_HTTP_REQUESTS_DURATION_SECONDS , AXUM_HTTP_REQUESTS_TOTAL } ;
1
+ pub use axum:: { AXUM_HTTP_REQUESTS_DURATION_SECONDS , AXUM_HTTP_REQUESTS_TOTAL } ;
2
2
3
3
pub const IC_REPLICA_REQUESTS_TOTAL : & str = "ic-replica-requests-total" ;
4
4
pub const IC_REPLICA_REQUESTS_DURATION_SECONDS : & str = "ic-replica-requests-duration-seconds" ;
5
5
6
6
pub mod axum {
7
7
use axum:: { extract:: MatchedPath , middleware:: Next , response:: Response , routing:: get, Router } ;
8
8
use http:: Request ;
9
- use metrics_exporter_prometheus:: { BuildError , PrometheusBuilder } ;
9
+ use metrics_exporter_prometheus:: { BuildError , Matcher , PrometheusBuilder } ;
10
10
use std:: time:: Instant ;
11
11
12
- pub use metrics_exporter_prometheus:: Matcher ;
13
-
14
12
pub const AXUM_HTTP_REQUESTS_TOTAL : & str = "axum-http-requests-total" ;
15
13
pub const AXUM_HTTP_REQUESTS_DURATION_SECONDS : & str = "axum-http-requests-duration-seconds" ;
16
14
@@ -21,7 +19,7 @@ pub mod axum {
21
19
app : Router < S > ,
22
20
global_buckets : Option < & [ f64 ] > ,
23
21
global_labels : Option < Vec < ( K , V ) > > ,
24
- matched_metric_buckets : Option < Vec < ( Matcher , & [ f64 ] ) > > ,
22
+ matched_metric_buckets : Option < Vec < ( & str , & [ f64 ] ) > > ,
25
23
) -> Result < Router < S > , BuildError >
26
24
where
27
25
K : Into < String > ,
@@ -45,9 +43,9 @@ pub mod axum {
45
43
} ;
46
44
47
45
let builder = if let Some ( buckets) = matched_metric_buckets {
48
- buckets
49
- . into_iter ( )
50
- . try_fold ( builder , |b , ( k , v ) | b . set_buckets_for_metric ( k , v ) ) ?
46
+ buckets. into_iter ( ) . try_fold ( builder , |b , ( k , v ) | {
47
+ b . set_buckets_for_metric ( Matcher :: Full ( k . to_owned ( ) ) , v )
48
+ } ) ?
51
49
} else {
52
50
builder
53
51
} ;
0 commit comments