You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by ko...@apache.org on 2025/03/28 10:45:31 UTC
(opendal) 01/01: chore(layer/observe): cleanup useless metric metadata
This is an automated email from the ASF dual-hosted git repository.
koushiro pushed a commit to branch koushiro/remove-useless-metric-metadata
in repository https://gitbox.apache.org/repos/asf/opendal.git
commit fbe5ef925848c50a77f222870b9351b6f8ed1641
Author: koushiro <ko...@gmail.com>
AuthorDate: Fri Mar 28 18:45:13 2025 +0800
chore(layer/observe): cleanup useless metric metadata
---
core/src/layers/observe/metrics.rs | 54 --------------------------------------
core/src/layers/observe/mod.rs | 6 -----
2 files changed, 60 deletions(-)
diff --git a/core/src/layers/observe/metrics.rs b/core/src/layers/observe/metrics.rs
index a7c5ce38c..dc20b8f1d 100644
--- a/core/src/layers/observe/metrics.rs
+++ b/core/src/layers/observe/metrics.rs
@@ -17,7 +17,6 @@
use std::fmt::Debug;
use std::fmt::Formatter;
-use std::fmt::Write;
use std::pin::Pin;
use std::sync::Arc;
use std::task::ready;
@@ -343,59 +342,6 @@ impl MetricValue {
}
}
-/// The metric metadata which contains the metric name and help.
-pub struct MetricMetadata {
- name: &'static str,
- help: &'static str,
-}
-
-impl MetricMetadata {
- /// Returns the metric name.
- ///
- /// We default to using the metric name with the prefix `opendal_`.
- pub fn name(&self) -> String {
- self.name_with_prefix("opendal_".to_string())
- }
-
- /// Returns the metric name with a given prefix.
- pub fn name_with_prefix(&self, mut prefix: String) -> String {
- // This operation must succeed. If an error does occur, let's just ignore it.
- let _ = prefix.write_str(self.name);
- prefix
- }
-
- /// Returns the metric help.
- pub fn help(&self) -> &'static str {
- self.help
- }
-}
-
-/// The metric metadata for the operation duration in seconds.
-pub static METRIC_OPERATION_DURATION_SECONDS: MetricMetadata = MetricMetadata {
- name: "operation_duration_seconds",
- help: "Histogram of time spent during opendal operations",
-};
-/// The metric metadata for the operation bytes.
-pub static METRIC_OPERATION_BYTES: MetricMetadata = MetricMetadata {
- name: "operation_bytes",
- help: "Histogram of the bytes transferred during opendal operations",
-};
-/// The metric metadata for the operation errors total.
-pub static METRIC_OPERATION_ERRORS_TOTAL: MetricMetadata = MetricMetadata {
- name: "operation_errors_total",
- help: "Error counter during opendal operations",
-};
-/// The metric metadata for the http request duration in seconds.
-pub static METRIC_HTTP_REQUEST_DURATION_SECONDS: MetricMetadata = MetricMetadata {
- name: "http_request_duration_seconds",
- help: "Histogram of time spent during http requests",
-};
-/// The metric metadata for the http request bytes.
-pub static METRIC_HTTP_REQUEST_BYTES: MetricMetadata = MetricMetadata {
- name: "http_request_bytes",
- help: "Histogram of the bytes transferred during http requests",
-};
-
/// The interceptor for metrics.
///
/// All metrics related libs should implement this trait to observe opendal's internal operations.
diff --git a/core/src/layers/observe/mod.rs b/core/src/layers/observe/mod.rs
index 86959b3ca..56a778fb0 100644
--- a/core/src/layers/observe/mod.rs
+++ b/core/src/layers/observe/mod.rs
@@ -75,7 +75,6 @@
mod metrics;
pub use metrics::MetricLabels;
-pub use metrics::MetricMetadata;
pub use metrics::MetricValue;
pub use metrics::MetricsAccessor;
pub use metrics::MetricsIntercept;
@@ -92,8 +91,3 @@ pub use metrics::LABEL_OPERATION;
pub use metrics::LABEL_ROOT;
pub use metrics::LABEL_SCHEME;
pub use metrics::LABEL_STATUS_CODE;
-pub use metrics::METRIC_HTTP_REQUEST_BYTES;
-pub use metrics::METRIC_HTTP_REQUEST_DURATION_SECONDS;
-pub use metrics::METRIC_OPERATION_BYTES;
-pub use metrics::METRIC_OPERATION_DURATION_SECONDS;
-pub use metrics::METRIC_OPERATION_ERRORS_TOTAL;