File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
common/health_metrics/src Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -27,8 +27,8 @@ pub static PROCESS_SHR_MEM: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
27
27
"Shared memory used by the current process" ,
28
28
)
29
29
} ) ;
30
- pub static PROCESS_SECONDS : LazyLock < Result < IntGauge > > = LazyLock :: new ( || {
31
- try_create_int_gauge (
30
+ pub static PROCESS_SECONDS : LazyLock < Result < IntCounter > > = LazyLock :: new ( || {
31
+ try_create_int_counter (
32
32
"process_cpu_seconds_total" ,
33
33
"Total cpu time taken by the current process" ,
34
34
)
@@ -135,8 +135,13 @@ pub fn scrape_process_health_metrics() {
135
135
set_gauge ( & PROCESS_RES_MEM , health. pid_mem_resident_set_size as i64 ) ;
136
136
set_gauge ( & PROCESS_VIRT_MEM , health. pid_mem_virtual_memory_size as i64 ) ;
137
137
set_gauge ( & PROCESS_SHR_MEM , health. pid_mem_shared_memory_size as i64 ) ;
138
- set_gauge ( & PROCESS_SECONDS , health. pid_process_seconds_total as i64 ) ;
139
- }
138
+
139
+ if let Ok ( counter) = & * PROCESS_SECONDS {
140
+ let new_val = health. pid_process_seconds_total as u64 ;
141
+ counter. reset ( ) ;
142
+ counter. inc_by ( new_val) ;
143
+ }
144
+ }
140
145
}
141
146
142
147
pub fn scrape_system_health_metrics ( ) {
You can’t perform that action at this time.
0 commit comments