pub fn update_metrics(&self) {
        let mut counts = HashMap::new();
        for (semaphore, &full_count) in &self.semaphores {
            // Ok, currently we don't support changing the full_count at runtime, but let's keep it
            // here for later use.
            FULL_COUNT.with_label_values(&[semaphore]).set(full_count);
            // Doing all these nasty allocations before acquiring the lock to leases
            counts.insert(semaphore.clone(), Counts::default());
        }
        // Most of the work happens in here. Now counts contains the active and pending counts
        self.leases.lock().unwrap().fill_counts(&mut counts);
        let now = Instant::now();
        for (semaphore, count) in counts {
            COUNT.with_label_values(&[&semaphore]).set(count.acquired);
            PENDING.with_label_values(&[&semaphore]).set(count.pending);
            LONGEST_PENDING_SEC
                .with_label_values(&[&semaphore])
                .set(count.longest_pending(now).as_secs() as i64)
        }
    }
/// Update the registered prometheus metrics with values reflecting the current state.State
///
/// This method updates the global default prometheus regestry.
Update the registered prometheus metrics with values reflecting the current state.State
This method updates the global default prometheus regestry.
Update the registered prometheus metrics with values reflecting the current state . State This method updates the global default prometheus regestry .
pub fn update_metrics(&self) {
        let mut counts = HashMap::new();
        for (semaphore, &full_count) in &self.semaphores {
            // Ok, currently we don't support changing the full_count at runtime, but let's keep it
            // here for later use.
            FULL_COUNT.with_label_values(&[semaphore]).set(full_count);
            // Doing all these nasty allocations before acquiring the lock to leases
            counts.insert(semaphore.clone(), Counts::default());
        }
        // Most of the work happens in here. Now counts contains the active and pending counts
        self.leases.lock().unwrap().fill_counts(&mut counts);
        let now = Instant::now();
        for (semaphore, count) in counts {
            COUNT.with_label_values(&[&semaphore]).set(count.acquired);
            PENDING.with_label_values(&[&semaphore]).set(count.pending);
            LONGEST_PENDING_SEC
                .with_label_values(&[&semaphore])
                .set(count.longest_pending(now).as_secs() as i64)
        }
    }
pub fn update_metrics ( & self ) { let mut counts = HashMap :: new ( ) ; for ( semaphore , & full_count ) in & self . semaphores { // Ok, currently we don't support changing the full_count at runtime, but let's keep it // here for later use. FULL_COUNT . with_label_values ( & [ semaphore ] ) . set ( full_count ) ; // Doing all these nasty allocations before acquiring the lock to leases counts . insert ( semaphore . clone ( ) , Counts :: default ( ) ) ; } // Most of the work happens in here. Now counts contains the active and pending counts self . leases . lock ( ) . unwrap ( ) . fill_counts ( & mut counts ) ; let now = Instant :: now ( ) ; for ( semaphore , count ) in counts { COUNT . with_label_values ( & [ & semaphore ] ) . set ( count . acquired ) ; PENDING . with_label_values ( & [ & semaphore ] ) . set ( count . pending ) ; LONGEST_PENDING_SEC . with_label_values ( & [ & semaphore ] ) . set ( count . longest_pending ( now ) . as_secs ( ) as i64 ) } }
Update the registered prometheus metrics with values reflecting the current state.State
This method updates the global default prometheus regestry.
Update the registered prometheus metrics with values reflecting the current state . State This method updates the global default prometheus regestry .
&self
&self