Skip to content

Commit 3e41e87

Browse files
committed
add OPENDAL_RETRIES_COUNT
1 parent c44ea20 commit 3e41e87

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/common/storage/src/operator.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ use crate::metrics_layer::METRICS_LAYER;
5858
use crate::runtime_layer::RuntimeLayer;
5959
use 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.
6265
pub fn init_operator(cfg: &StorageParams) -> Result<Operator> {
6366
let op = match &cfg {
@@ -389,6 +392,8 @@ pub struct DatabendRetryInterceptor;
389392

390393
impl 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: {:?}",

0 commit comments

Comments
 (0)