File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,9 @@ use crate::metrics_layer::METRICS_LAYER;
5858use crate :: runtime_layer:: RuntimeLayer ;
5959use crate :: StorageConfig ;
6060
61+ static METRIC_OPENDAL_RETRIES_COUNT : LazyLock < FamilyCounter < Vec < ( & ' static str , String ) > > > =
62+ LazyLock :: new ( || register_counter_family ( "opendal_retries_count" ) ) ;
63+
6164/// init_operator will init an opendal operator based on storage config.
6265pub fn init_operator ( cfg : & StorageParams ) -> Result < Operator > {
6366 let op = match & cfg {
@@ -389,6 +392,8 @@ pub struct DatabendRetryInterceptor;
389392
390393impl RetryInterceptor for DatabendRetryInterceptor {
391394 fn intercept ( & self , err : & opendal:: Error , dur : Duration ) {
395+ let labels = vec ! [ ( "err" , err. kind( ) . to_string( ) ) ] ;
396+ METRIC_OPENDAL_RETRIES_COUNT . get_or_create ( & labels) . incr ( ) ;
392397 warn ! (
393398 target: "opendal::layers::retry" ,
394399 "will retry after {:.2}s because: {:?}" ,
You can’t perform that action at this time.
0 commit comments