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

Method set

prometheus_client/metrics.py:458–464  ·  view source on GitHub ↗

Set gauge to the given value.

(self, value: float)

Source from the content-addressed store, hash-verified

456 self._value.inc(-amount)
457
458 def set(self, value: float) -> None:
459 """Set gauge to the given value."""
460 self._raise_if_not_observable()
461 if self._is_most_recent:
462 self._value.set(float(value), timestamp=time.time())
463 else:
464 self._value.set(float(value))
465
466 def set_to_current_time(self) -> None:
467 """Set gauge to the current unixtime."""

Callers 15

set_to_current_timeMethod · 0.95
test_gauge_allMethod · 0.95
test_gauge_liveallMethod · 0.95
test_gauge_minMethod · 0.95
test_gauge_liveminMethod · 0.95
test_gauge_maxMethod · 0.95
test_gauge_livemaxMethod · 0.95
test_gauge_sumMethod · 0.95
test_gauge_livesumMethod · 0.95
test_gauge_mostrecentMethod · 0.95
test_gaugeMethod · 0.95

Calls 2

timeMethod · 0.45

Tested by 15

test_gauge_allMethod · 0.76
test_gauge_liveallMethod · 0.76
test_gauge_minMethod · 0.76
test_gauge_liveminMethod · 0.76
test_gauge_maxMethod · 0.76
test_gauge_livemaxMethod · 0.76
test_gauge_sumMethod · 0.76
test_gauge_livesumMethod · 0.76
test_gauge_mostrecentMethod · 0.76
test_gaugeMethod · 0.76
test_gaugeMethod · 0.76