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 04:54:13 UTC
(opendal) branch koushiro/impl-obsever-for-otelmetrics updated (b9475ee2f -> e3a6f0ebf)
This is an automated email from the ASF dual-hosted git repository.
koushiro pushed a change to branch koushiro/impl-obsever-for-otelmetrics
in repository https://gitbox.apache.org/repos/asf/opendal.git
omit b9475ee2f specify name explictly
new e3a6f0ebf specify name explictly
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (b9475ee2f)
\
N -- N -- N refs/heads/koushiro/impl-obsever-for-otelmetrics (e3a6f0ebf)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
core/src/layers/otelmetrics.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(opendal) 01/01: specify name explictly
Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
koushiro pushed a commit to branch koushiro/impl-obsever-for-otelmetrics
in repository https://gitbox.apache.org/repos/asf/opendal.git
commit e3a6f0ebff15130a2f94570e361368d5d266b4e8
Author: koushiro <ko...@gmail.com>
AuthorDate: Fri Mar 28 12:52:55 2025 +0800
specify name explictly
---
core/src/layers/otelmetrics.rs | 140 ++++++++++++++++++++++++++++-------------
1 file changed, 96 insertions(+), 44 deletions(-)
diff --git a/core/src/layers/otelmetrics.rs b/core/src/layers/otelmetrics.rs
index d8a17e6ce..e848edab3 100644
--- a/core/src/layers/otelmetrics.rs
+++ b/core/src/layers/otelmetrics.rs
@@ -176,72 +176,147 @@ impl OtelMetricsLayerBuilder {
pub fn register(self, meter: &Meter) -> OtelMetricsLayer {
let operation_bytes = {
let metric = observe::MetricValue::OperationBytes(0);
- register_u64_histogram_meter(meter, metric, self.bytes_boundaries.clone())
+ register_u64_histogram_meter(
+ meter,
+ "opendal.operation.bytes",
+ metric,
+ self.bytes_boundaries.clone(),
+ )
};
let operation_bytes_rate = {
let metric = observe::MetricValue::OperationBytesRate(0.0);
- register_f64_histogram_meter(meter, metric, self.bytes_rate_boundaries.clone())
+ register_f64_histogram_meter(
+ meter,
+ "opendal.operation.bytes_rate",
+ metric,
+ self.bytes_rate_boundaries.clone(),
+ )
};
let operation_entries = {
let metric = observe::MetricValue::OperationEntries(0);
- register_u64_histogram_meter(meter, metric, self.entries_boundaries.clone())
+ register_u64_histogram_meter(
+ meter,
+ "opendal.operation.entries",
+ metric,
+ self.entries_boundaries.clone(),
+ )
};
let operation_entries_rate = {
let metric = observe::MetricValue::OperationEntriesRate(0.0);
- register_f64_histogram_meter(meter, metric, self.entries_rate_boundaries.clone())
+ register_f64_histogram_meter(
+ meter,
+ "opendal.operation.entries_rate",
+ metric,
+ self.entries_rate_boundaries.clone(),
+ )
};
let operation_duration_seconds = {
let metric = observe::MetricValue::OperationDurationSeconds(Duration::default());
- register_f64_histogram_meter(meter, metric, self.duration_seconds_boundaries.clone())
+ register_f64_histogram_meter(
+ meter,
+ "opendal.operation.duration",
+ metric,
+ self.duration_seconds_boundaries.clone(),
+ )
};
let operation_errors_total = {
let metric = observe::MetricValue::OperationErrorsTotal;
- register_u64_counter_meter(meter, metric)
+ meter
+ .u64_counter("opendal.operation.errors")
+ .with_description(metric.help())
+ .build()
};
let operation_executing = {
let metric = observe::MetricValue::OperationExecuting(0);
- register_i64_up_down_counter_meter(meter, metric)
+ meter
+ .i64_up_down_counter("opendal.operation.executing")
+ .with_description(metric.help())
+ .build()
};
let operation_ttfb_seconds = {
let metric = observe::MetricValue::OperationTtfbSeconds(Duration::default());
- register_f64_histogram_meter(meter, metric, self.duration_seconds_boundaries.clone())
+ register_f64_histogram_meter(
+ meter,
+ "opendal.operation.ttfb",
+ metric,
+ self.duration_seconds_boundaries.clone(),
+ )
};
let http_executing = {
let metric = observe::MetricValue::HttpExecuting(0);
- register_i64_up_down_counter_meter(meter, metric)
+ meter
+ .i64_up_down_counter("opendal.http.executing")
+ .with_description(metric.help())
+ .build()
};
let http_request_bytes = {
let metric = observe::MetricValue::HttpRequestBytes(0);
- register_u64_histogram_meter(meter, metric, self.bytes_boundaries.clone())
+ register_u64_histogram_meter(
+ meter,
+ "opendal.http.request.bytes",
+ metric,
+ self.bytes_boundaries.clone(),
+ )
};
let http_request_bytes_rate = {
let metric = observe::MetricValue::HttpRequestBytesRate(0.0);
- register_f64_histogram_meter(meter, metric, self.bytes_rate_boundaries.clone())
+ register_f64_histogram_meter(
+ meter,
+ "opendal.http.request.bytes_rate",
+ metric,
+ self.bytes_rate_boundaries.clone(),
+ )
};
let http_request_duration_seconds = {
let metric = observe::MetricValue::HttpRequestDurationSeconds(Duration::default());
- register_f64_histogram_meter(meter, metric, self.duration_seconds_boundaries.clone())
+ register_f64_histogram_meter(
+ meter,
+ "opendal.http.request.duration",
+ metric,
+ self.duration_seconds_boundaries.clone(),
+ )
};
let http_response_bytes = {
let metric = observe::MetricValue::HttpResponseBytes(0);
- register_u64_histogram_meter(meter, metric, self.bytes_boundaries.clone())
+ register_u64_histogram_meter(
+ meter,
+ "opendal.http.response.bytes",
+ metric,
+ self.bytes_boundaries.clone(),
+ )
};
let http_response_bytes_rate = {
let metric = observe::MetricValue::HttpResponseBytesRate(0.0);
- register_f64_histogram_meter(meter, metric, self.bytes_rate_boundaries.clone())
+ register_f64_histogram_meter(
+ meter,
+ "opendal.http.response.bytes_rate",
+ metric,
+ self.bytes_rate_boundaries.clone(),
+ )
};
let http_response_duration_seconds = {
let metric = observe::MetricValue::HttpResponseDurationSeconds(Duration::default());
- register_f64_histogram_meter(meter, metric, self.duration_seconds_boundaries.clone())
+ register_f64_histogram_meter(
+ meter,
+ "opendal.http.response.duration",
+ metric,
+ self.duration_seconds_boundaries.clone(),
+ )
};
let http_connection_errors_total = {
let metric = observe::MetricValue::HttpConnectionErrorsTotal;
- register_u64_counter_meter(meter, metric)
+ meter
+ .u64_counter("opendal.http.connection_errors")
+ .with_description(metric.help())
+ .build()
};
let http_status_errors_total = {
let metric = observe::MetricValue::HttpStatusErrorsTotal;
- register_u64_counter_meter(meter, metric)
+ meter
+ .u64_counter("opendal.http.status_errors")
+ .with_description(metric.help())
+ .build()
};
OtelMetricsLayer {
@@ -421,11 +496,11 @@ pub fn exponential_boundaries(start: f64, factor: f64, count: usize) -> Vec<f64>
fn register_u64_histogram_meter(
meter: &Meter,
+ name: &'static str,
metric: observe::MetricValue,
boundaries: Vec<f64>,
) -> Histogram<u64> {
- let (name, unit) = metric.name_with_unit();
- let name = name.replace("_", ".");
+ let (_name, unit) = metric.name_with_unit();
let description = metric.help();
let builder = meter
@@ -442,11 +517,11 @@ fn register_u64_histogram_meter(
fn register_f64_histogram_meter(
meter: &Meter,
+ name: &'static str,
metric: observe::MetricValue,
boundaries: Vec<f64>,
) -> Histogram<f64> {
- let (name, unit) = metric.name_with_unit();
- let name = name.replace("_", ".");
+ let (_name, unit) = metric.name_with_unit();
let description = metric.help();
let builder = meter
@@ -460,26 +535,3 @@ fn register_f64_histogram_meter(
builder.build()
}
}
-
-fn register_u64_counter_meter(meter: &Meter, metric: observe::MetricValue) -> Counter<u64> {
- let name = metric.name().replace("_", ".");
- let description = metric.help();
-
- meter
- .u64_counter(name)
- .with_description(description)
- .build()
-}
-
-fn register_i64_up_down_counter_meter(
- meter: &Meter,
- metric: observe::MetricValue,
-) -> UpDownCounter<i64> {
- let name = metric.name().replace("_", ".");
- let description = metric.help();
-
- meter
- .i64_up_down_counter(name)
- .with_description(description)
- .build()
-}