class_docstr: Container for all the COUNTER and GAUGE metrics extracted from an OpenMetrics endpoint.
class_docstr_tok: ["Container","for","all","the","COUNTER","and","GAUGE","metrics","extracted","from","an","OpenMetrics","endpoint","."]
code: def __init__(
      self,
      name: str,
      url: str,
      filters: Union[
          Mapping[str, Mapping[str, str]], Sequence[str], None
      ],
  ) -> None:
      self.name = name  # user-defined name for the endpoint
      self.url = url  # full URL
  
      # - filters can be a dict {"<metric regex>": {"<label>": "<filter regex>"}}
      #   or a sequence of metric regexes. we convert the latter to a dict
      #   to make it easier to work with.
      # - the metric regexes are matched against the full metric name,
      #   i.e. "<endpoint name>.<metric name>".
      # - by default, all metrics are captured.
      self.filters = (
          filters
          if isinstance(filters, Mapping)
          else {k: {} for k in filters or [".*"]}
      )
      self.filters_tuple = (
          _nested_dict_to_tuple(self.filters) if self.filters else ()
      )
  
      self._session: Optional[requests.Session] = None
      self.samples: Deque[dict] = deque([])
      # {"<metric name>": {"<labels hash>": <index>}}
      self.label_map: Dict[str, Dict[str, int]] = defaultdict(dict)
      # {"<labels hash>": <labels>}
      self.label_hashes: Dict[str, dict] = {}
  
imports: import logging
  import re
  import sys
  import threading
  from collections import defaultdict, deque
  from functools import lru_cache
  from types import ModuleType
  from typing import TYPE_CHECKING, Dict, List, Mapping, Sequence, Tuple, Union
  import requests
  import requests.adapters
  import urllib3
  import wandb
  from wandb.sdk.lib import hashutil, telemetry
  from .aggregators import aggregate_last, aggregate_mean
  from .interfaces import Interface, Metric, MetricsMonitor
label_desc: Use image node_id 1 to create a new OpenMetricsMetric object  with example: obj = OpenMetricsMetric(name, url, filters)