docstr: Create a new metric and add into cache
  
  Parameters
  ----------
  metric_name str
      Name of metric
  
  metric_type MetricTypes
      Type of metric Counter, Gauge, Histogram
  
  Returns
  -------
  Metrics object or MetricsCacheKeyError if not found
docstr_tok: ["Create","a","new","metric","and","add","into","cache","Parameters","--","--","--","--","--","metric_name","str","Name","of","metric","metric_type","MetricTypes","Type","of","metric","Counter",",","Gauge",",","Histogram","Returns","--","--","--","-","Metrics","object","or","MetricsCacheKeyError","if","not","found"]
code: def get_metric(
      self,
      metric_name: str,
      metric_type: MetricTypes = MetricTypes.COUNTER,
  ) -> CachingMetric:
      """
      Create a new metric and add into cache
  
      Parameters
      ----------
      metric_name str
          Name of metric
  
      metric_type MetricTypes
          Type of metric Counter, Gauge, Histogram
  
      Returns
      -------
      Metrics object or MetricsCacheKeyError if not found
      """
      self._check_type(metric_name, str, "`metric_name` must be a str")
      self._check_type(
          metric_type,
          MetricTypes,
          "`metric_type` must be a MetricTypes enum",
      )
      try:
          metric = self.cache[metric_type][metric_name]
      except KeyError:
          raise merrors.MetricsCacheKeyError(
              f"Metric of type '{metric_type}' and name '{metric_name}' doesn't exist"
          )
      else:
          return metric
  
file_path: serve/ts/metrics/metric_cache_yaml_impl.py
imports: import logging
  import yaml
  import ts.metrics.metric_cache_errors
  from ts.metrics.caching_metric import CachingMetric
  from ts.metrics.metric_cache_abstract import MetricCacheAbstract
  from ts.metrics.metric_type_enum import MetricTypes
label_desc: Use image node_id 6 for calling the MetricsCacheYamlImpl obj's underlying member method code with example usage: obj.get_metric(metric_name, metric_type) and returns: metric