Compare commits
No commits in common. "825d4157668a82405657a9448c322c0f686937a7" and "a67531ce988ee415df83fbbba92ac7c65abd62c9" have entirely different histories.
825d415766
...
a67531ce98
3
.gitignore
vendored
3
.gitignore
vendored
@ -4,5 +4,4 @@ TIME.py
|
|||||||
.vscode
|
.vscode
|
||||||
tests
|
tests
|
||||||
qeqeqe
|
qeqeqe
|
||||||
env
|
env
|
||||||
handlers/userdata.json
|
|
3
bot.py
3
bot.py
@ -4,7 +4,6 @@ from create_bot import dp
|
|||||||
import handlers
|
import handlers
|
||||||
import json, logging
|
import json, logging
|
||||||
from global_conf import CONFIG
|
from global_conf import CONFIG
|
||||||
from prometheus_client import start_http_server
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -45,7 +44,7 @@ logging.getLogger("aiogram").addFilter(filter_grammar_messages)
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
#print(CONFIG)
|
#print(CONFIG)
|
||||||
start_http_server(1337)
|
|
||||||
logging.info('Бот в строю.')
|
logging.info('Бот в строю.')
|
||||||
executor.start_polling(dp, skip_updates=True)
|
executor.start_polling(dp, skip_updates=True)
|
||||||
logging.info('Всем пока.')
|
logging.info('Всем пока.')
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
from db_logic import collections
|
from db_logic import collections
|
||||||
from handlers.metrics import metric_wrap
|
|
||||||
import datetime, logging
|
import datetime, logging
|
||||||
|
|
||||||
|
|
||||||
@ -59,7 +58,6 @@ def update_dick_size(message, user, updatedDick ):
|
|||||||
overwrite_mode='update'
|
overwrite_mode='update'
|
||||||
)
|
)
|
||||||
|
|
||||||
metric_wrap(message.chat.id, message.from_user.full_name, updatedDick, user['attempts'] + 1)
|
|
||||||
logging.info(f'Успешно апдейтнули пипису @{message.from_user.username}')
|
logging.info(f'Успешно апдейтнули пипису @{message.from_user.username}')
|
||||||
except Exception as e2:
|
except Exception as e2:
|
||||||
logging.error(f'ошибка DB в /dick :: обновление пиписы @{message.from_user.username}')
|
logging.error(f'ошибка DB в /dick :: обновление пиписы @{message.from_user.username}')
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
import json
|
|
||||||
import time
|
|
||||||
from prometheus_client import Gauge, Info
|
|
||||||
|
|
||||||
|
|
||||||
class user_info_struct:
|
|
||||||
user_id: str
|
|
||||||
user_fullname: str
|
|
||||||
dick_size: int
|
|
||||||
datetimes: str
|
|
||||||
attemptsCount: int
|
|
||||||
chat_id: int
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def metric_wrap(chatID:int, userName: str, length: int, attemptsCount: int):
|
|
||||||
"""Pass here chat ID, username, pipisa length and attempts count to wrap them into metric."""
|
|
||||||
|
|
||||||
pipisa_length_metric = Gauge('user_length_total', 'Pipisa length', labelnames=['ChatID', 'Username'])
|
|
||||||
user_attempt_metric = Gauge('user_attempts_total', 'Attempts count', labelnames=['ChatID', 'Username'])
|
|
||||||
user_last_attempt_metric = Gauge('user_last_attempt_time', 'Last attempt time', labelnames=['ChatID', 'Username'])
|
|
||||||
|
|
||||||
pipisa_length_metric.labels(chatID, userName).set(length)
|
|
||||||
user_attempt_metric.labels(chatID, userName).set(attemptsCount)
|
|
||||||
user_last_attempt_metric.labels(chatID, userName).set(time.time_ns())
|
|
@ -1,4 +1,3 @@
|
|||||||
aiogram==2.15
|
aiogram==2.15
|
||||||
python-arango
|
python-arango
|
||||||
pyyaml
|
pyyaml
|
||||||
prometheus-client
|
|
Loading…
x
Reference in New Issue
Block a user