(request)
return HttpResponse(
        metrics_page, content_type=prometheus_client.CONTENT_TYPE_LATEST
    )
Exports /metrics as a Django view. Only available in DEBUG mode.
Exports /metrics as a Django view. Only available in DEBUG mode.
Exports / metrics as a Django view . Only available in DEBUG mode .
def prometheus_metrics(request):
    """Exports /metrics as a Django view. Only available in DEBUG mode.
    """
    if not settings.DEBUG:
        return HttpResponseNotFound()

    if "prometheus_multiproc_dir" in os.environ:
        registry = prometheus_client.CollectorRegistry()
        multiprocess.MultiProcessCollector(registry)
    else:
        registry = prometheus_client.REGISTRY
    metrics_page = prometheus_client.generate_latest(registry)
    return HttpResponse(
        metrics_page, content_type=prometheus_client.CONTENT_TYPE_LATEST
    )
def prometheus_metrics ( request ) : if not settings . DEBUG : return HttpResponseNotFound ( ) if "prometheus_multiproc_dir" in os . environ : registry = prometheus_client . CollectorRegistry ( ) multiprocess . MultiProcessCollector ( registry ) else : registry = prometheus_client . REGISTRY metrics_page = prometheus_client . generate_latest ( registry ) return HttpResponse ( metrics_page , content_type = prometheus_client . CONTENT_TYPE_LATEST )