class_docstr: Mixin for the request handling monitoring
  
  :param metrics_registry: optional metrics registry for prometheus used if we need to expose metrics from the executor or from the data request handler
  :param runtime_name: optional runtime_name that will be registered during monitoring
code: def __init__(
      self,
      metrics_registry: Optional["CollectorRegistry"] = None,
      meter: Optional["Meter"] = None,
      runtime_name: Optional[str] = None,
  ):
      self._request_init_time = {} if metrics_registry else None
      self._meter_request_init_time = {} if meter else None
  
      if metrics_registry:
          with ImportExtensions(
              required=True,
              help_text="You need to install the `prometheus_client` to use the montitoring functionality of jina",
          ):
              from prometheus_client import Counter, Gauge, Summary
  
              from jina.serve.monitoring import _SummaryDeprecated
  
          self._receiving_request_metrics = Summary(
              "receiving_request_seconds",
              "Time spent processing successful request",
              registry=metrics_registry,
              namespace="jina",
              labelnames=("runtime_name",),
          ).labels(runtime_name)
  
          self._pending_requests_metrics = Gauge(
              "number_of_pending_requests",
              "Number of pending requests",
              registry=metrics_registry,
              namespace="jina",
              labelnames=("runtime_name",),
          ).labels(runtime_name)
  
          self._failed_requests_metrics = Counter(
              "failed_requests",
              "Number of failed requests",
              registry=metrics_registry,
              namespace="jina",
              labelnames=("runtime_name",),
          ).labels(runtime_name)
  
          self._successful_requests_metrics = Counter(
              "successful_requests",
              "Number of successful requests",
              registry=metrics_registry,
              namespace="jina",
              labelnames=("runtime_name",),
          ).labels(runtime_name)
  
          self._request_size_metrics = _SummaryDeprecated(
              old_name="request_size_bytes",
              name="received_request_bytes",
              documentation="The size in bytes of the request returned to the client",
              namespace="jina",
              labelnames=("runtime_name",),
              registry=metrics_registry,
          ).labels(runtime_name)
  
          self._sent_response_bytes = Summary(
              "sent_response_bytes",
              "The size in bytes of the request returned to the client",
              namespace="jina",
              labelnames=("runtime_name",),
              registry=metrics_registry,
          ).labels(runtime_name)
  
      else:
          self._receiving_request_metrics = None
          self._pending_requests_metrics = None
          self._failed_requests_metrics = None
          self._successful_requests_metrics = None
          self._request_size_metrics = None
          self._sent_response_bytes = None
  
      if meter:
          self._receiving_request_histogram = meter.create_histogram(
              name="jina_receiving_request_seconds",
              description="Time spent processing successful request",
          )
  
          self._pending_requests_up_down_counter = (
              meter.create_up_down_counter(
                  name="jina_number_of_pending_requests",
                  description="Number of pending requests",
              )
          )
  
          self._failed_requests_counter = meter.create_counter(
              name="jina_failed_requests",
              description="Number of failed requests",
          )
  
          self._successful_requests_counter = meter.create_counter(
              name="jina_successful_requests",
              description="Number of successful requests",
          )
  
          self._request_size_histogram = meter.create_histogram(
              name="jina_received_request_bytes",
              description="The size in bytes of the request returned to the client",
          )
  
          self._sent_response_bytes_histogram = meter.create_histogram(
              name="jina_sent_response_bytes",
              description="The size in bytes of the request returned to the client",
          )
      else:
          self._receiving_request_histogram = None
          self._pending_requests_up_down_counter = None
          self._failed_requests_counter = None
          self._successful_requests_counter = None
          self._request_size_histogram = None
          self._sent_response_bytes_histogram = None
      self._metric_labels = {"runtime_name": runtime_name}
  
file_path: jina/jina/serve/runtimes/monitoring.py
imports: import time
  from typing import TYPE_CHECKING, Optional, Union
  from jina.importer import ImportExtensions
  from jina.proto import jina_pb2
label_desc: Use image node_id 1 to create a new MonitoringRequestMixin object  with example: obj = MonitoringRequestMixin(metrics_registry, meter, runtime_name)