Esempio n. 1
0
def is_alive(request):
  metrics = global_registry().dump_metrics()

  if 'requests.response-time' in metrics:
    LOG.info('Is Alive Metrics [request.response-time]: %(requests.response-time)s' % metrics)

  return HttpResponse('')
Esempio n. 2
0
File: views.py Progetto: Lt-Pone/hue
def index(request):
  if request.GET.get('pretty') == 'true':
    indent = 2
  else:
    indent = None

  rep = {
      'timestamp': datetime.datetime.utcnow().isoformat(),
      'metric': global_registry().dump_metrics(),
  }
  return JsonResponse(rep, indent=indent)
Esempio n. 3
0
def index(request):
    if request.GET.get('pretty') == 'true':
        indent = 2
    else:
        indent = None

    rep = {
        'timestamp': datetime.datetime.utcnow().isoformat(),
        'metric': global_registry().dump_metrics(),
    }
    return JsonResponse(rep, indent=indent)
Esempio n. 4
0
def index(request):
  if request.GET.get('pretty') == 'true':
    indent = 2
  else:
    indent = None

  rep = {
      'timestamp': datetime.datetime.utcnow().isoformat(),
      'metric': global_registry().dump_metrics(),
  }
  LOG.debug('Metrics: %s' % json.dumps(rep, indent=indent))
  return JsonResponse(rep, json_dumps_params={'indent': indent})
Esempio n. 5
0
def index(request):
  if request.GET.get('pretty') == 'true':
    indent = 2
  else:
    indent = None

  rep = {
      'timestamp': datetime.datetime.utcnow().isoformat(),
      'metric': global_registry().dump_metrics(),
  }

  if request.is_ajax():
    return JsonResponse(rep, json_dumps_params={'indent': indent})
  else:
    return render("metrics.mako", request, {'metrics': json.dumps(rep['metric']), 'is_embeddable': request.GET.get('is_embeddable', False)})
Esempio n. 6
0
def index(request):
    if request.GET.get('pretty') == 'true':
        indent = 2
    else:
        indent = None

    rep = {
        'timestamp': datetime.datetime.utcnow().isoformat(),
        'metric': global_registry().dump_metrics(),
    }

    if request.is_ajax():
        return JsonResponse(rep, json_dumps_params={'indent': indent})
    else:
        return render(
            "metrics.mako", request, {
                'metrics': json.dumps(rep['metric']),
                'is_embeddable': request.GET.get('is_embeddable', False)
            })