def prometheus_metrics(): total_alert_gauge.set(Alert.get_count()) output = Gauge.find_all() output += Counter.find_all() output += Timer.find_all() return Response([o.serialize(format='prometheus') for o in output], content_type='text/plain; version=0.0.4; charset=utf-8')
def status(): now = int(time.time() * 1000) total_alert_gauge.set(Alert.get_count()) metrics = Gauge.find_all() metrics.extend(Counter.find_all()) metrics.extend(Timer.find_all()) metrics.extend(Switch.find_all()) return jsonify(application="alerta", version=__version__, time=now, uptime=int(now - started), metrics=[metric.serialize() for metric in metrics])
def prometheus_metrics(): total_alert_gauge.set(Alert.get_count()) output = Gauge.find_all() output += Counter.find_all() output += Timer.find_all() return Response( [o.serialize(format='prometheus') for o in output], content_type='text/plain; version=0.0.4; charset=utf-8' )