MCPcopy Index your code
hub / github.com/prometheus/client_python / test_gauge_mostrecent

Method test_gauge_mostrecent

tests/test_multiprocess.py:188–196  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

186 self.assertEqual(2, self.registry.get_sample_value('g'))
187
188 def test_gauge_mostrecent(self):
189 g1 = Gauge('g', 'help', registry=None, multiprocess_mode='mostrecent')
190 values.ValueClass = MultiProcessValue(lambda: 456)
191 g2 = Gauge('g', 'help', registry=None, multiprocess_mode='mostrecent')
192 g2.set(2)
193 g1.set(1)
194 self.assertEqual(1, self.registry.get_sample_value('g'))
195 mark_process_dead(123, os.environ['PROMETHEUS_MULTIPROC_DIR'])
196 self.assertEqual(1, self.registry.get_sample_value('g'))
197
198 def test_gauge_livemostrecent(self):
199 g1 = Gauge('g', 'help', registry=None, multiprocess_mode='livemostrecent')

Callers

nothing calls this directly

Calls 5

setMethod · 0.95
MultiProcessValueFunction · 0.90
mark_process_deadFunction · 0.90
GaugeClass · 0.85
get_sample_valueMethod · 0.80

Tested by

no test coverage detected