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

Function _parse_value_and_timestamp

prometheus_client/parser.py:221–231  ·  view source on GitHub ↗
(s: str)

Source from the content-addressed store, hash-verified

219
220# If we have multiple values only consider the first
221def _parse_value_and_timestamp(s: str) -> Tuple[float, Optional[float]]:
222 s = s.lstrip()
223 separator = " "
224 if separator not in s:
225 separator = "\t"
226 values = [value.strip() for value in s.split(separator) if value.strip()]
227 if not values:
228 return float(s), None
229 value = _parse_value(values[0])
230 timestamp = (_parse_value(values[-1]) / 1000) if len(values) > 1 else None
231 return value, timestamp
232
233
234def _parse_value(value):

Callers 1

_parse_sampleFunction · 0.85

Calls 1

_parse_valueFunction · 0.85

Tested by

no test coverage detected