You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uniffle.apache.org by zu...@apache.org on 2024/02/16 03:13:42 UTC
(incubator-uniffle) branch master updated: [#1407] feat(rust): fix + add total grpc request metrics (#1516)
This is an automated email from the ASF dual-hosted git repository.
zuston pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git
The following commit(s) were added to refs/heads/master by this push:
new 9291a27b7 [#1407] feat(rust): fix + add total grpc request metrics (#1516)
9291a27b7 is described below
commit 9291a27b749b8b5f0560745cd87226a1a12e515c
Author: Junfan Zhang <zu...@apache.org>
AuthorDate: Fri Feb 16 11:13:37 2024 +0800
[#1407] feat(rust): fix + add total grpc request metrics (#1516)
### What changes were proposed in this pull request?
1. fix grpc queue size metric
2. add total grpc request metrics
### Why are the changes needed?
For #1407
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Needn't
---
rust/experimental/server/src/grpc.rs | 5 +++--
rust/experimental/server/src/metric.rs | 13 ++++++++++++-
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/rust/experimental/server/src/grpc.rs b/rust/experimental/server/src/grpc.rs
index 7557512d7..1ff4bd400 100644
--- a/rust/experimental/server/src/grpc.rs
+++ b/rust/experimental/server/src/grpc.rs
@@ -720,7 +720,7 @@ impl ShuffleServer for DefaultShuffleServer {
}
pub mod metrics_middleware {
- use crate::metric::GAUGE_GRPC_REQUEST_QUEUE_SIZE;
+ use crate::metric::{GAUGE_GRPC_REQUEST_QUEUE_SIZE, TOTAL_GRPC_REQUEST};
use hyper::service::Service;
use hyper::Body;
use prometheus::HistogramVec;
@@ -769,6 +769,7 @@ pub mod metrics_middleware {
}
fn call(&mut self, req: hyper::Request<Body>) -> Self::Future {
+ TOTAL_GRPC_REQUEST.inc();
GAUGE_GRPC_REQUEST_QUEUE_SIZE.inc();
// This is necessary because tonic internally uses `tower::buffer::Buffer`.
@@ -787,7 +788,7 @@ pub mod metrics_middleware {
timer.observe_duration();
- GAUGE_GRPC_REQUEST_QUEUE_SIZE.inc();
+ GAUGE_GRPC_REQUEST_QUEUE_SIZE.dec();
Ok(response)
})
diff --git a/rust/experimental/server/src/metric.rs b/rust/experimental/server/src/metric.rs
index 03e53bc07..a7998a8ec 100644
--- a/rust/experimental/server/src/metric.rs
+++ b/rust/experimental/server/src/metric.rs
@@ -245,8 +245,11 @@ pub static GAUGE_TOPN_APP_RESIDENT_DATA_SIZE: Lazy<IntGaugeVec> = Lazy::new(|| {
pub static GAUGE_IN_SPILL_DATA_SIZE: Lazy<IntGauge> =
Lazy::new(|| IntGauge::new("in_spill_data_size", "total data size in spill").unwrap());
+pub static TOTAL_GRPC_REQUEST: Lazy<IntCounter> =
+ Lazy::new(|| IntCounter::new("total_grpc_request_number", "total request number").expect(""));
+
pub static GAUGE_GRPC_REQUEST_QUEUE_SIZE: Lazy<IntGauge> =
- Lazy::new(|| IntGauge::new("grpc_request_queue_size", "grpc request queue size").unwrap());
+ Lazy::new(|| IntGauge::new("grpc_request_number", "current grpc request queue size").unwrap());
pub static TOTAL_SPILL_EVENTS_DROPPED: Lazy<IntCounter> = Lazy::new(|| {
IntCounter::new(
@@ -257,6 +260,14 @@ pub static TOTAL_SPILL_EVENTS_DROPPED: Lazy<IntCounter> = Lazy::new(|| {
});
fn register_custom_metrics() {
+ REGISTRY
+ .register(Box::new(TOTAL_GRPC_REQUEST.clone()))
+ .expect("");
+
+ REGISTRY
+ .register(Box::new(GAUGE_GRPC_REQUEST_QUEUE_SIZE.clone()))
+ .expect("");
+
REGISTRY
.register(Box::new(TOTAL_SPILL_EVENTS_DROPPED.clone()))
.expect("");