mirror of
https://github.com/tgbot-collection/ytdlbot.git
synced 2025-02-26 00:05:32 +08:00
enable audio, add metrics from redis
This commit is contained in:
parent
d672dc848f
commit
03c20d0de5
2 changed files with 19 additions and 3 deletions
|
@ -237,9 +237,27 @@ class InfluxDB:
|
|||
]
|
||||
self.client.write_points(json_body)
|
||||
|
||||
def __fill_redis_metrics(self):
|
||||
json_body = [
|
||||
{
|
||||
"measurement": "metrics",
|
||||
"time": datetime.datetime.utcnow(),
|
||||
"fields": {
|
||||
}
|
||||
}
|
||||
]
|
||||
r = Redis().r
|
||||
hash_keys = r.hgetall("metrics")
|
||||
for key, value in hash_keys.items():
|
||||
if re.findall(r"^today", key):
|
||||
json_body[0]["fields"][key] = int(value)
|
||||
|
||||
self.client.write_points(json_body)
|
||||
|
||||
def collect_data(self):
|
||||
with contextlib.suppress(Exception):
|
||||
data = self.get_worker_data()
|
||||
self.__fill_worker_data(data)
|
||||
self.__fill_overall_data(data)
|
||||
self.__fill_redis_metrics()
|
||||
logging.debug("InfluxDB data was collected.")
|
||||
|
|
|
@ -63,9 +63,7 @@ def download_entrance(bot_msg, client, url):
|
|||
|
||||
def audio_entrance(bot_msg):
|
||||
if ENABLE_CELERY:
|
||||
normal_audio(bot_msg)
|
||||
# disable celery audio conversion for now
|
||||
# audio_task.delay(bot_msg.chat.id, bot_msg.message_id)
|
||||
audio_task.delay(bot_msg.chat.id, bot_msg.message_id)
|
||||
else:
|
||||
normal_audio(bot_msg)
|
||||
|
||||
|
|
Loading…
Reference in a new issue