def process_request(self, request): transport = self._transport(request) method = self._method(request) requests_by_method.labels(method).inc() requests_by_transport.labels(transport).inc() if request.is_ajax(): ajax_requests.inc() requests_body_bytes.observe(len(request.body)) request.prometheus_after_middleware_event = Time()
def process_request(self, request): transport = self._transport(request) method = self._method(request) requests_by_method.labels(method).inc() requests_by_transport.labels(transport).inc() if request.is_ajax(): ajax_requests.inc() content_length = int(request.META.get("CONTENT_LENGTH") or 0) requests_body_bytes.observe(content_length) request.prometheus_after_middleware_event = Time()
def process_request(self, request): transport = self._transport(request) method = self._method(request) self.label_metric(self.metrics.requests_by_method, request, method=method).inc() self.label_metric( self.metrics.requests_by_transport, request, transport=transport ).inc() if request.is_ajax(): self.label_metric(self.metrics.requests_ajax, request).inc() content_length = int(request.META.get("CONTENT_LENGTH") or 0) self.label_metric(self.metrics.requests_body_bytes, request).observe( content_length ) request.prometheus_after_middleware_event = Time()
def process_request(self, request): transport = self._transport(request) method = self._method(request) self.label_metric(self.metrics.requests_by_method, request, method=method).inc() self.label_metric(self.metrics.requests_by_transport, request, transport=transport).inc() # Mimic the behaviour of the deprecated "Request.is_ajax()" method. if request.META.get("HTTP_X_REQUESTED_WITH") == "XMLHttpRequest": self.label_metric(self.metrics.requests_ajax, request).inc() content_length = int(request.META.get("CONTENT_LENGTH") or 0) self.label_metric(self.metrics.requests_body_bytes, request).observe(content_length) request.prometheus_after_middleware_event = Time()
def process_request(self, request): requests_total.inc() request.prometheus_before_middleware_event = Time()
def process_request(self, request): request.prometheus_before_middleware_event = Time() content_length = int(request.META.get('CONTENT_LENGTH') or 0) http_request_size.observe(content_length)
def process_request(self, request): request.prometheus_after_middleware_event = Time()
def process_request(self, request): self.metrics.requests_total.labels(hostname=HOSTNAME).inc() request.prometheus_before_middleware_event = Time()