Skip to content

Commit

Permalink
Add prometheus (hsdevelops#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
huishun98 authored Nov 16, 2023
1 parent 446673d commit 1319dce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
from teleapi import endpoints as teleapi
from threading import Thread
from fastapi import FastAPI, Response
from prometheus_fastapi_instrumentator import Instrumentator

import config
from bot.ptb import lifespan

cpu_usage = Gauge("cpu_usage", "CPU Usage")
memory_usage = Gauge("memory_usage", "Memory Usage")

app = FastAPI(lifespan=lifespan) if config.ENV else FastAPI()
Instrumentator().instrument(app).expose(app)
cpu_usage = Gauge("cpu_usage", "CPU Usage")
memory_usage = Gauge("memory_usage", "Memory Usage")


@app.get("/")
Expand Down
1 change: 0 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import asyncio
from http import HTTPStatus
from fastapi import Request, Response
from telegram.ext import (
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pathspec==0.9.0
platformdirs==2.5.2
pluggy==1.0.0
prometheus-client==0.16.0
prometheus-fastapi-instrumentator==6.1.0
protobuf==3.20.1
psutil==5.9.5
pyaes==1.6.1
Expand Down

0 comments on commit 1319dce

Please sign in to comment.