def main(fd: int, backlog: int):
    """
    Start a standalone Prometheus server to use with gRPC.
    \b
    This is an internal API, users should not use this directly. Instead use 'bentoml serve-grpc'.
    Prometheus then can be accessed at localhost:9090
    """

    import socket

    import psutil
    import uvicorn
    from a2wsgi import WSGIMiddleware
    from starlette.applications import Starlette
    from starlette.middleware import Middleware

    from bentoml._internal.configuration import get_debug_mode
    from bentoml._internal.configuration.containers import BentoMLContainer
    from bentoml._internal.context import server_context
    from bentoml._internal.log import configure_server_logging

    server_context.service_type = "prom_server"

    configure_server_logging()

    BentoMLContainer.development_mode.set(False)
    metrics_client = BentoMLContainer.metrics_client.get()
    # create a ASGI app that wraps around the default HTTP prometheus server.
    prom_app = Starlette(
        debug=get_debug_mode(), middleware=[Middleware(GenerateLatestMiddleware)]
    )
    prom_app.mount("/", WSGIMiddleware(metrics_client.make_wsgi_app()))
    sock = socket.socket(fileno=fd)

    uvicorn_options: dict[str, t.Any] = {
        "backlog": backlog,
        "log_config": None,
        "workers": 1,
    }
    if psutil.WINDOWS:
        uvicorn_options["loop"] = "asyncio"
        import asyncio

        asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())  # type: ignore
    uvicorn.Server(uvicorn.Config(prom_app, **uvicorn_options)).run(sockets=[sock])
Start a standalone Prometheus server to use with gRPC.
\b
This is an internal API, users should not use this directly. Instead use 'bentoml serve-grpc'.
Prometheus then can be accessed at localhost:9090
src/bentoml_cli/worker/grpc_prometheus_server.py