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

Method test_gauge_all

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

Source from the content-addressed store, hash-verified

98 self.assertEqual(2, self.registry.get_sample_value('h_bucket', {'le': '5.0'}))
99
100 def test_gauge_all(self):
101 g1 = Gauge('g', 'help', registry=None)
102 values.ValueClass = MultiProcessValue(lambda: 456)
103 g2 = Gauge('g', 'help', registry=None)
104 self.assertEqual(0, self.registry.get_sample_value('g', {'pid': '123'}))
105 self.assertEqual(0, self.registry.get_sample_value('g', {'pid': '456'}))
106 g1.set(1)
107 g2.set(2)
108 mark_process_dead(123)
109 self.assertEqual(1, self.registry.get_sample_value('g', {'pid': '123'}))
110 self.assertEqual(2, self.registry.get_sample_value('g', {'pid': '456'}))
111
112 def test_gauge_liveall(self):
113 g1 = Gauge('g', 'help', registry=None, multiprocess_mode='liveall')

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