MCPcopy Create free account
hub / github.com/dfinity/orbit / gauge_vec_mut

Method gauge_vec_mut

libs/orbit-essentials/src/metrics.rs:121–141  ·  view source on GitHub ↗

Returns a gauge vec metric with the given name, helper message, and set of label names. The label names are used to partition the gauge metric into multiple dimensions.

(
        &mut self,
        name: &str,
        helper_message: &str,
        label_names: &[&str],
    )

Source from the content-addressed store, hash-verified

119 ///
120 /// The label names are used to partition the gauge metric into multiple dimensions.
121 pub fn gauge_vec_mut(
122 &mut self,
123 name: &str,
124 helper_message: &str,
125 label_names: &[&str],
126 ) -> &mut GaugeVec {
127 match self.metric_gauge_vecs.entry(name.to_string()) {
128 Entry::Occupied(entry) => entry.into_mut(),
129 Entry::Vacant(entry) => {
130 let gauge = GaugeVec::new(
131 Opts::new(format!("{}_{}", self.service_name, name), helper_message),
132 label_names,
133 )
134 .unwrap();
135
136 self.registry.register(Box::new(gauge.clone())).unwrap();
137
138 entry.insert(gauge)
139 }
140 }
141 }
142
143 /// Removes a counter vec metric with the given name.
144 pub fn remove_gauge_vec(&mut self, name: &str) {

Callers 6

getMethod · 0.80
setMethod · 0.80
incMethod · 0.80
decMethod · 0.80
test_metrics_registryFunction · 0.80
test_remove_gauge_vecFunction · 0.80

Calls 2

registerMethod · 0.45
insertMethod · 0.45

Tested by 2

test_metrics_registryFunction · 0.64
test_remove_gauge_vecFunction · 0.64