def protect_metric_with_auth_key(function):

    def wrap(controller, request, *args, **kwargs):
        if (kwargs['type'] == 'prometheus'):
            prometheus_token = Option_Entity().get_one_by_key('prometheus_token')
            if ((prometheus_token.value != '') and (('HTTP_AUTHORIZATION' not in request.META) or (prometheus_token.value != request.META['HTTP_AUTHORIZATION']))):
                raise Http404('Host not found.')
        return function(controller, request, *args, **kwargs)
    return wrap
def protect_metric_with_auth_key(function):

    def wrap(controller, request, *args, **kwargs):
        if (kwargs['type'] == 'prometheus'):
            prometheus_token = Option_Entity().get_one_by_key('prometheus_token')
            if ((prometheus_token.value != ) and (('HTTP_AUTHORIZATION' not in request.META) or (prometheus_token.value != request.META['HTTP_AUTHORIZATION']))):
                raise Http404('Host not found.')
        return function(controller, request, *args, **kwargs)
    return wrap