@app.route('/webhooks/prometheus', methods=['OPTIONS', 'POST'])
@cross_origin()
@auth_required
def prometheus():

    if request.json and 'alerts' in request.json:
        hook_started = webhook_timer.start_timer()
        status = request.json['status']
        for alert in request.json['alerts']:
            try:
                incomingAlert = parse_prometheus(status, alert)
            except __HOLE__ as e:
                webhook_timer.stop_timer(hook_started)
                return jsonify(status="error", message=str(e)), 400

            if g.get('customer', None):
                incomingAlert.customer = g.get('customer')

            try:
                process_alert(incomingAlert)
            except RejectException as e:
                webhook_timer.stop_timer(hook_started)
                return jsonify(status="error", message=str(e)), 403
            except Exception as e:
                webhook_timer.stop_timer(hook_started)
                return jsonify(status="error", message=str(e)), 500

        webhook_timer.stop_timer(hook_started)
    else:
        return jsonify(status="error", message="no alerts in Prometheus notification payload"), 400

    return jsonify(status="ok"), 200
dataset/ETHPy150Open guardian/alerta/alerta/app/webhooks/views.py/prometheus