Skip to content

start_http_server with make_asgi_app? #987

Description

@mecampbellsoup

Hi guys,

Quick question and hopefully not a dumb one but, nevertheless:

start_http_server only works with make_wsgi_app - is there anything preventing one from doing something similar with make_asgi_app instead?

An alternative is to install prometheus-async which has its own start_http_server.

We have a FastAPI + uvicorn (ASGI) application and are looking to expose some Prometheus metrics for export.

Activity

  1. LordKa0S commented on Jan 25, 2024

    @LordKa0S
    from fastapi import FastAPI
    import prometheus_client
    
    app = FastAPI()
    metrics_app = prometheus_client.make_asgi_app()
    app.mount("/metrics", metrics_app)

    Originally posted by @pquentin in #512 (comment)

  2. locked and limited conversation to collaborators on Jan 25, 2024
  3. converted this issue into a discussion #1000 on Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions