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

Function _escape_grouping_key

prometheus_client/exposition.py:782–791  ·  view source on GitHub ↗
(k, v)

Source from the content-addressed store, hash-verified

780
781
782def _escape_grouping_key(k, v):
783 if v == "":
784 # Per https://github.com/prometheus/pushgateway/pull/346.
785 return k + "@base64", "="
786 elif '/' in v or ' ' in v:
787 # Added in Pushgateway 0.9.0.
788 # Use base64 encoding for values containing slashes or spaces
789 return k + "@base64", base64.urlsafe_b64encode(v.encode("utf-8")).decode("utf-8")
790 else:
791 return k, quote_plus(v)
792
793
794def instance_ip_grouping_key() -> Dict[str, Any]:

Callers 1

_use_gatewayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected