docstr: Add a time based metric like latency, default unit is 'ms'
      Default metric type is gauge
  
  Parameters
  ----------
  name : str
      metric name
  value: int or float
      value of the metric
  idx: str
      request id to be associated with the metric
  unit: str
      unit of metric,  default here is ms, s is also accepted
  dimensions: list
      list of Dimension objects for the metric
  metric_type MetricTypes
      Type of metric Counter, Gauge, Histogram
docstr_tok: ["Add","a","time","based","metric","like","latency",",","default","unit","is","'ms'","Default","metric","type","is","gauge","Parameters","--","--","--","--","--","name",":","str","metric","name","value",":","int","or","float","value","of","the","metric","idx",":","str","request","id","to","be","associated","with","the","metric","unit",":","str","unit","of","metric",",","default","here","is","ms",",","s","is","also","accepted","dimensions",":","list","list","of","Dimension","objects","for","the","metric","metric_type","MetricTypes","Type","of","metric","Counter",",","Gauge",",","Histogram"]
code: def add_time(
      self,
      name: str,
      value: int or float,
      idx: str = None,
      unit: str = "ms",
      dimensions: list = [],
      metric_type: MetricTypes = MetricTypes.GAUGE,
  ):
      """
      Add a time based metric like latency, default unit is 'ms'
          Default metric type is gauge
  
      Parameters
      ----------
      name : str
          metric name
      value: int or float
          value of the metric
      idx: str
          request id to be associated with the metric
      unit: str
          unit of metric,  default here is ms, s is also accepted
      dimensions: list
          list of Dimension objects for the metric
      metric_type MetricTypes
          Type of metric Counter, Gauge, Histogram
      """
      if unit not in ["ms", "s"]:
          raise merrors.MetricsCacheValueError(
              "the unit for a timed metric should be one of ['ms', 's']"
          )
      req_id = self._get_req(idx)
      dimensions = self._add_default_dims(req_id, dimensions)
      metric = self._get_or_add_metric(
          name, unit, dimensions, metric_type
      )
      metric.add_or_update(
          value, [dim.value for dim in dimensions], req_id
      )
  
imports: import abc
  import os
  import ts.metrics.metric_cache_errors
  from ts.metrics.dimension import Dimension
  from ts.metrics.metric_abstract import MetricAbstract
  from ts.metrics.metric_type_enum import MetricTypes
label_desc: Use image node_id 7 for calling the MetricCacheAbstract obj's underlying member method code with example usage: obj.add_time(name, value, idx, unit, dimensions, metric_type) without return types