File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ static OMIT_FILTER_ROWS: LazyLock<Counter> = LazyLock::new(|| register_counter("
3535struct StorageHttpLabels {
3636 host : String ,
3737 method : String ,
38+ bucket : String ,
3839}
3940
4041static STORAGE_HTTP_REQUESTS_COUNT : LazyLock < FamilyCounter < StorageHttpLabels > > =
@@ -320,9 +321,13 @@ pub fn metrics_inc_omit_filter_rows(c: u64) {
320321}
321322
322323/// Storage Http metrics.
323- pub fn metrics_inc_storage_http_requests_count ( host : String , method : String ) {
324+ pub fn metrics_inc_storage_http_requests_count ( host : String , method : String , bucket : String ) {
324325 STORAGE_HTTP_REQUESTS_COUNT
325- . get_or_create ( & StorageHttpLabels { host, method } )
326+ . get_or_create ( & StorageHttpLabels {
327+ host,
328+ method,
329+ bucket,
330+ } )
326331 . inc ( ) ;
327332}
328333
Original file line number Diff line number Diff line change @@ -60,7 +60,16 @@ impl HttpFetch for StorageHttpClient {
6060 }
6161 m => m. as_str ( ) ,
6262 } ;
63- metrics_inc_storage_http_requests_count ( host. to_string ( ) , method. to_string ( ) ) ;
63+ // get first component in path as bucket name
64+ let bucket = match url. path_segments ( ) {
65+ Some ( mut segments) => segments. next ( ) . unwrap_or ( "-" ) ,
66+ None => "-" ,
67+ } ;
68+ metrics_inc_storage_http_requests_count (
69+ host. to_string ( ) ,
70+ method. to_string ( ) ,
71+ bucket. to_string ( ) ,
72+ ) ;
6473
6574 let ( parts, body) = req. into_parts ( ) ;
6675
You can’t perform that action at this time.
0 commit comments