Struct opendal::layers::MetricsLayer
source · pub struct MetricsLayer;
Expand description
MetricsLayer will add metrics for OpenDAL.
Metrics
opendal_requests_total
: Total requests numbers;opendal_requests_duration_seconds
: Request duration seconds;opendal_errors_total
: number of errors encountered, like file not found;opendal_bytes_total
: bytes read/write from/to underlying storage, only avalid about for IO operations likeread
andwrite
Labels
All metrics will carry the following labels
service
: Service name fromScheme
operation
: Operation name fromOperation
error_kind
:ErrorKind
of counted errors.- only available for
opendal_errors_total
- only available for
Examples
use anyhow::Result;
use opendal::layers::MetricsLayer;
use opendal::Operator;
use opendal::Scheme;
let _ = Operator::from_env(Scheme::Fs)
.expect("must init")
.layer(MetricsLayer);
Trait Implementations§
source§impl Clone for MetricsLayer
impl Clone for MetricsLayer
source§fn clone(&self) -> MetricsLayer
fn clone(&self) -> MetricsLayer
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more