Skip to content

Commit

Permalink
added test labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Asker Kakhramanov committed Feb 24, 2024
1 parent 62f2fd5 commit ce51520
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions generate/bot-generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,24 @@
bot=telebot.TeleBot(os.environ.get('generate_bot'))

REQUESTS_START = Counter('bot_generate_start_total',
'Bot generate start requested.')
'Bot generate start requested.',
labelnames=['path'])

REQUESTS_GENERATE_NICKNAME = Counter('bot_generate_nickname_total',
'Bot generate nickname requested.')
'Bot generate nickname requested.',
labelnames=['path'])

REQUESTS_GENERATE_PASSWORD = Counter('bot_generate_password_total',
'Bot generate password requested.')
'Bot generate password requested.',
labelnames=['path'])

REQUESTS_GENERATE_PORT_NUMBER = Counter('bot_generate_port_number_total',
'Bot generate port number requested.')
'Bot generate port number requested.',
labelnames=['path'])

REQUESTS_GENERATE_PIN = Counter('bot_generate_pin',
'Bot generate pin requested.')
'Bot generate pin requested.',
labelnames=['path'])

LAST = Gauge('bot_generate_last_time_seconds',
'The last time a bot generate was served.')
Expand All @@ -33,8 +38,8 @@ def escape_markdown(text):
return ''.join('\\' + char if char in escape_chars else char for char in text)

@bot.message_handler(commands=['start'])
def start(message):
REQUESTS_START.inc()
def start(message, self):
REQUESTS_START.labels(self.path).inc()
"""
Обработчик команды /start. Отправляет пользователю приветственное сообщение и информацию о боте.
"""
Expand Down

0 comments on commit ce51520

Please sign in to comment.