Tiny add smg_manual_policy_cache_entries metric (#15987)
This commit is contained in:
@@ -190,6 +190,10 @@ pub fn init_metrics() {
|
||||
"smg_worker_errors_total",
|
||||
"Worker-level errors by worker_type, connection_mode, error_type"
|
||||
);
|
||||
describe_gauge!(
|
||||
"smg_manual_policy_cache_entries",
|
||||
"Number of routing entries in manual policy cache"
|
||||
);
|
||||
|
||||
// Layer 3: Worker resilience metrics (circuit breaker)
|
||||
describe_gauge!(
|
||||
@@ -810,6 +814,11 @@ impl Metrics {
|
||||
.increment(1);
|
||||
}
|
||||
|
||||
/// Set manual policy cache entries count
|
||||
pub fn set_manual_policy_cache_entries(count: usize) {
|
||||
gauge!("smg_manual_policy_cache_entries").set(count as f64);
|
||||
}
|
||||
|
||||
/// Record consistent hashing policy execution branch for routing decisions
|
||||
pub fn record_worker_consistent_hashing_policy_branch(branch: &'static str) {
|
||||
counter!(
|
||||
|
||||
@@ -161,6 +161,7 @@ impl LoadBalancingPolicy for ManualPolicy {
|
||||
fn select_worker(&self, workers: &[Arc<dyn Worker>], info: &SelectWorkerInfo) -> Option<usize> {
|
||||
let (result, branch) = self.select_worker_impl(workers, info);
|
||||
Metrics::record_worker_manual_policy_branch(branch.as_str());
|
||||
Metrics::set_manual_policy_cache_entries(self.routing_map.len());
|
||||
result
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user