/opt/cloudlinux/venv/lib/python3.11/site-packages/prometheus_client
from urllib.parse import parse_qs from .exposition import _bake_output from .registry import REGISTRY def make_asgi_app(registry=REGISTRY): """Create a ASGI app which serves the metrics from a registry.""" async def prometheus_app(scope, receive, send): assert scope.get("type") == "http" # Prepare parameters params = parse_qs(scope.get('query_string', b'')) accept_header = "Accept: " + ",".join([ value.decode("utf8") for (name, value) in scope.get('headers') if name.decode("utf8") == 'accept' ]) # Bake output status, header, output = _bake_output(registry, accept_header, params) # Return output payload = await receive() if payload.get("type") == "http.request": await send( { "type": "http.response.start", "status": int(status.split(' ')[0]), "headers": [ tuple(x.encode('utf8') for x in header) ] } ) await send({"type": "http.response.body", "body": output}) return prometheus_app
.
Edit
..
Edit
__init__.py
Edit
__pycache__
Edit
asgi.py
Edit
bridge
Edit
context_managers.py
Edit
core.py
Edit
decorator.py
Edit
exposition.py
Edit
gc_collector.py
Edit
metrics.py
Edit
metrics_core.py
Edit
mmap_dict.py
Edit
multiprocess.py
Edit
openmetrics
Edit
parser.py
Edit
platform_collector.py
Edit
process_collector.py
Edit
registry.py
Edit
samples.py
Edit
twisted
Edit
utils.py
Edit
values.py
Edit