File: main.py

package info (click to toggle)
prometheus-fastapi-instrumentator 7.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 492 kB
  • sloc: python: 2,586; makefile: 5
file content (18 lines) | stat: -rw-r--r-- 366 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from fastapi import FastAPI
from prometheus_client import Counter, start_http_server

from prometheus_fastapi_instrumentator import Instrumentator

start_http_server(9000)

PING_TOTAL = Counter("ping", "Number of pings calls.")

app = FastAPI()

Instrumentator().instrument(app).expose(app)


@app.get("/ping")
def get_ping():
    PING_TOTAL.inc()
    return "pong"