diff --git a/prometheus_client/asgi.py b/prometheus_client/asgi.py index 6f72838b..e2ac2be3 100644 --- a/prometheus_client/asgi.py +++ b/prometheus_client/asgi.py @@ -9,6 +9,10 @@ def make_asgi_app(registry: CollectorRegistry = REGISTRY, disable_compression: b """Create a ASGI app which serves the metrics from a registry.""" async def prometheus_app(scope, receive, send): + if scope.get("type") == "lifespan": + payload = await receive() + await send({'type': payload['type'] + ".complete"}) + return assert scope.get("type") == "http" # Prepare parameters params = parse_qs(scope.get('query_string', b''))