class_docstr: Class for generating metrics and printing it to stdout of the worker
class_docstr_tok: ["Class","for","generating","metrics","and","printing","it","to","stdout","of","the","worker"]
docstr: Update metric value, request id and dimensions
  
  Parameters
  ----------
  value : int, float
      metric to be updated
  dimension_values : list
      list of dimension value strings
  request_id : str
      request id to be associated with the metric
docstr_tok: ["Update","metric","value",",","request","id","and","dimensions","Parameters","--","--","--","--","--","value",":","int",",","float","metric","to","be","updated","dimension_values",":","list","list","of","dimension","value","strings","request_id",":","str","request","id","to","be","associated","with","the","metric"]
code: def add_or_update(
      self,
      value: int or float,
      dimension_values: list = [],
      request_id: str = "",
  ):
      """
      Update metric value, request id and dimensions
  
      Parameters
      ----------
      value : int, float
          metric to be updated
      dimension_values : list
          list of dimension value strings
      request_id : str
          request id to be associated with the metric
      """
      dimension_str = ""
      try:
          dimension_objs = self._validate_and_get_dimensions(
              dimension_values
          )
          dimension_str = ",".join([str(d) for d in dimension_objs])
          self._validate_metric_value(value)
      except ValueError as ex:
          logger.error(
              f"[METRICS]Failed to update metric with name:"
              f"{self.metric_name} and dimensions: {dimension_str} "
              f"with value: {value}: {ex}"
          )
      else:
          self.emit_metrics(request_id, value, dimension_str)
  
file_path: serve/ts/metrics/caching_metric.py
imports: import logging
  import socket
  import time
  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 5 for calling the CachingMetric obj's underlying member method code with example usage: obj.add_or_update(value, dimension_values, request_id) without return types