33 lines
712 B
Python
33 lines
712 B
Python
from prometheus_client import Histogram, start_http_server
|
|
|
|
DOWNLOAD_DURATION = Histogram(
|
|
'tt_download_time',
|
|
'Time taken to download a single tiktok video',
|
|
['service'],
|
|
buckets=[0.1, 0.5, 1, 2, 5, 10, 30, 60, 120]
|
|
)
|
|
|
|
FILE_SIZE_BYTES = Histogram(
|
|
'downloaded_file_size_bytes',
|
|
'Size of the downloaded file in bytes',
|
|
['service'],
|
|
buckets=[
|
|
1e6, # 1 MB
|
|
5e6, # 5 MB
|
|
10e6, # 10 MB
|
|
25e6, # 25 MB
|
|
50e6, # 50 MB
|
|
100e6, # 100 MB
|
|
200e6, # 200 MB
|
|
500e6, # 500 MB
|
|
1e9 # 1 GB
|
|
]
|
|
)
|
|
|
|
|
|
def init_telemetry() -> None:
|
|
"""
|
|
Initialize telemetry for the bot.
|
|
"""
|
|
start_http_server(8000)
|