How to use the oncall.metrics function in oncall

To help you get started, we’ve selected a few oncall examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github linkedin / oncall / src / oncall / bin / notifier.py View on Github external
msg_info = send_queue.get()
    msg = {}
    msg['user'] = msg_info['user']
    msg['mode'] = msg_info['mode']
    context = json_loads(msg_info['context'])
    msg['subject'] = msg_info['subject'] % context
    msg['body'] = msg_info['body'] % context
    try:
        send_message(msg)
    except:
        logger.exception('Failed to send message %s', msg)
        mark_message_as_unsent(msg_info)
        metrics.stats['message_fail_cnt'] += 1
    else:
        mark_message_as_sent(msg_info)
        metrics.stats['message_sent_cnt'] += 1
github linkedin / oncall / src / oncall / bin / notifier.py View on Github external
def blackhole(msg):
    logger.info('Sent message %s' % msg)
    metrics.stats['message_blackhole_cnt'] += 1