Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
andylokandy committed Jan 8, 2025
1 parent a4d322c commit 998ea03
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions core/src/layers/otelmetrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use crate::*;
///
/// # fn main() -> Result<()> {
/// let _ = Operator::new(services::Memory::default())?
/// .layer(OtelMetricsLayer::default())
/// .layer(OtelMetricsLayer::builder().register())
/// .finish();
/// Ok(())
/// # }
Expand Down Expand Up @@ -68,7 +68,7 @@ impl OtelMetricsLayer {
/// # #[tokio::main]
/// # async fn main() -> Result<()> {
/// let op = Operator::new(services::Memory::default())?
/// .layer(OtelMetricsLayer::builder().path_label(1))
/// .layer(OtelMetricsLayer::builder().path_label(1).register())
/// .finish();
/// debug!("operator: {op:?}");
///
Expand Down Expand Up @@ -114,7 +114,7 @@ impl OtelMetricsLayerBuilder {
/// # #[tokio::main]
/// # async fn main() -> Result<()> {
/// let op = Operator::new(services::Memory::default())?
/// .layer(OtelMetricsLayer::builder().path_label(1))
/// .layer(OtelMetricsLayer::builder().path_label(1).register())
/// .finish();
/// debug!("operator: {op:?}");
///
Expand Down Expand Up @@ -204,29 +204,29 @@ impl OtelMetricsLayerBuilder {
/// # #[tokio::main]
/// # async fn main() -> Result<()> {
/// let op = Operator::new(services::Memory::default())?
/// .layer(OtelMetricsLayer::builder())
/// .layer(OtelMetricsLayer::builder().register())
/// .finish();
/// debug!("operator: {op:?}");
///
/// Ok(())
/// # }
/// ```
pub fn register(self) -> OtelMetricsLayer {
let meter = global::meter("opendal.operation");
let meter = global::meter("opendal");
let duration_seconds = meter
.f64_histogram("duration")
.f64_histogram("operation.operation.duration")
.with_description("Duration of operations")
.with_unit("second")
.with_boundaries(self.operation_duration_seconds_boundaries)
.build();
let bytes = meter
.u64_histogram("size")
.u64_histogram("operation.operation.size")
.with_description("Size of operations")
.with_unit("byte")
.with_boundaries(self.operation_bytes_boundaries)
.build();
let errors = meter
.u64_counter("errors")
.u64_counter("operation.operation.errors")
.with_description("Number of operation errors")
.build();

Expand Down

0 comments on commit 998ea03

Please sign in to comment.