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

Method export_metrics

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

Exports the metrics in the registry to a buffer in text format.

(&self)

Source from the content-addressed store, hash-verified

179
180 /// Exports the metrics in the registry to a buffer in text format.
181 pub fn export_metrics(&self) -> Result<Vec<u8>, prometheus::Error> {
182 let mut buffer = vec![];
183 let encoder = TextEncoder::new();
184
185 let registry = self.get_registry();
186 let metrics_family = registry.gather();
187
188 encoder.encode(&metrics_family, &mut buffer)?;
189
190 Ok(buffer)
191 }
192
193 /// Exports the metrics in the registry to an HTTP response.
194 pub fn export_metrics_as_http_response(&self) -> HttpResponse {

Callers 8

test_metrics_registryFunction · 0.80
test_remove_counter_vecFunction · 0.80
test_remove_counterFunction · 0.80
test_remove_gauge_vecFunction · 0.80
test_remove_gaugeFunction · 0.80

Calls 1

get_registryMethod · 0.80

Tested by 7

test_metrics_registryFunction · 0.64
test_remove_counter_vecFunction · 0.64
test_remove_counterFunction · 0.64
test_remove_gauge_vecFunction · 0.64
test_remove_gaugeFunction · 0.64