LCOV - code coverage report
Current view: top level - control_plane/attachment_service/src - metrics.rs (source / functions) Coverage Total Hit
Test: 322b88762cba8ea666f63cda880cccab6936bf37.info Lines: 0.0 % 16 0
Test Date: 2024-02-29 11:57:12 Functions: 0.0 % 4 0

            Line data    Source code
       1              : use metrics::{register_int_counter, register_int_counter_vec, IntCounter, IntCounterVec};
       2              : use once_cell::sync::Lazy;
       3              : 
       4              : pub(crate) struct ReconcilerMetrics {
       5              :     pub(crate) spawned: IntCounter,
       6              :     pub(crate) complete: IntCounterVec,
       7              : }
       8              : 
       9              : impl ReconcilerMetrics {
      10              :     // Labels used on [`Self::complete`]
      11              :     pub(crate) const SUCCESS: &'static str = "ok";
      12              :     pub(crate) const ERROR: &'static str = "success";
      13              :     pub(crate) const CANCEL: &'static str = "cancel";
      14              : }
      15              : 
      16            0 : pub(crate) static RECONCILER: Lazy<ReconcilerMetrics> = Lazy::new(|| ReconcilerMetrics {
      17            0 :     spawned: register_int_counter!(
      18            0 :         "storage_controller_reconcile_spawn",
      19            0 :         "Count of how many times we spawn a reconcile task",
      20            0 :     )
      21            0 :     .expect("failed to define a metric"),
      22            0 :     complete: register_int_counter_vec!(
      23            0 :         "storage_controller_reconcile_complete",
      24            0 :         "Reconciler tasks completed, broken down by success/failure/cancelled",
      25            0 :         &["status"],
      26            0 :     )
      27            0 :     .expect("failed to define a metric"),
      28            0 : });
      29              : 
      30            0 : pub fn preinitialize_metrics() {
      31            0 :     Lazy::force(&RECONCILER);
      32            0 : }
        

Generated by: LCOV version 2.1-beta