def execute_shutdown_handlers(): """Gracefully terminates the running application by running shutdown handlers. """ logger.info('Executing shutdown handlers.') while _SHUTDOWN_HANDLERS: handler = _SHUTDOWN_HANDLERS.pop() # Make sure we only run once. handler() logger.info('Flushing metrics.') root_metric_store().flush_all_publishers()
def get(self): metrics = root_metric_store().get_metrics() ordered_metrics = sorted(metrics, key=lambda metric: metric.name) return dict((m.name, m.value()) for m in ordered_metrics)
def get(self): metrics = root_metric_store().get_metrics() ordered_metrics = sorted(metrics, key=lambda metric: metric.name) joined = '\n'.join(['%s %s' % (m.name, m.value()) for m in ordered_metrics]) return Response(response=joined)