def make_wsgi_app(registry=REGISTRY):
    """Create a WSGI app which serves the metrics from a registry."""

    def prometheus_app(environ, start_response):
        params = parse_qs(environ.get('QUERY_STRING', ''))
        r = registry
        encoder, content_type = choose_encoder(environ.get('HTTP_ACCEPT'))
        if 'name[]' in params:
            r = r.restricted_registry(params['name[]'])
        output = encoder(r)

        status = str('200 OK')
        headers = [(str('Content-type'), content_type)]
        start_response(status, headers)
        return [output]

    return prometheus_app
def make_wsgi_app ( registry = REGISTRY ) : def prometheus_app ( environ , start_response ) : params = parse_qs ( environ . get ( 'QUERY_STRING' , '' ) ) r = registry encoder , content_type = choose_encoder ( environ . get ( 'HTTP_ACCEPT' ) ) if 'name[]' in params : r = r . restricted_registry ( params [ 'name[]' ] ) output = encoder ( r ) status = str ( '200 OK' ) headers = [ ( str ( 'Content-type' ) , content_type ) ] start_response ( status , headers ) return [ output ] return prometheus_app
Create a WSGI app which serves the metrics from a registry.