class_docstr: Takes care of collecting, sampling, serializing, and publishing a set of metrics.
class_docstr_tok: ["Takes","care","of","collecting",",","sampling",",","serializing",",","and","publishing","a","set","of","metrics","."]
code: def __init__(
      self,
      asset_name: str,
      metrics: List[Metric],
      interface: Interface,
      settings: "SettingsStatic",
      shutdown_event: threading.Event,
  ) -> None:
      self.metrics = metrics
      self.asset_name = asset_name
      self._interface = interface
      self._process: Optional[threading.Thread] = None
      self._shutdown_event: threading.Event = shutdown_event
  
      self.sampling_interval: float = float(
          max(
              0.1,
              settings._stats_sample_rate_seconds,
          )
      )  # seconds
      # The number of samples to aggregate (e.g. average or compute max/min etc.)
      # before publishing; defaults to 15; valid range: [1:30]
      self.samples_to_aggregate: int = min(
          30, max(1, settings._stats_samples_to_average)
      )
  
imports: import datetime
  import logging
  import sys
  import threading
  from typing import TYPE_CHECKING, Any, List, Optional, TypeVar
  import psutil
label_desc: Use image node_id 1 to create a new MetricsMonitor object  with example: obj = MetricsMonitor(asset_name, metrics, interface, settings, shutdown_event)