Skip to content

Commit

Permalink
Added prometheus client
Browse files Browse the repository at this point in the history
-- Defined metrics
  • Loading branch information
Amit Bhanja committed Feb 7, 2024
1 parent aac3acf commit 814e876
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/notify-email.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from notify_deps import get_logger, timestamp_convert, main
from notify_deps import NUVLA_ENDPOINT
from metrics import NOTIFICATIONS_SENT, NOTIFICATIONS_ERROR
from src.metrics import NOTIFICATIONS_SENT, NOTIFICATIONS_ERROR
from prometheus_client import start_http_server


Expand Down
3 changes: 3 additions & 0 deletions src/notify-slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from notify_deps import get_logger, timestamp_convert, main
from notify_deps import NUVLA_ENDPOINT
from src.metrics import NOTIFICATIONS_SENT, NOTIFICATIONS_ERROR
from prometheus_client import start_http_server

KAFKA_TOPIC = os.environ.get('KAFKA_TOPIC') or 'NOTIFICATIONS_SLACK_S'
Expand Down Expand Up @@ -128,7 +129,9 @@ def worker(workq: multiprocessing.Queue):
resp = send_message(dest, message_content(msg.value))
if not resp.ok:
log_local.error(f'Failed sending {msg} to {dest}: {resp.text}')
NOTIFICATIONS_ERROR.labels('slack', msg.value['SUBS_NAME'], dest, resp.text).inc()
else:
NOTIFICATIONS_SENT.labels('slack', msg.value['SUBS_NAME'], dest).inc()
log_local.info(f'sent: {msg} to {dest}')


Expand Down

0 comments on commit 814e876

Please sign in to comment.