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: Validations for metric value
  Parameters
  ----------
  value
      metric value to be updated
docstr_tok: ["Validations","for","metric","value","Parameters","--","--","--","--","--","value","metric","value","to","be","updated"]
code: def _validate_metric_value(
      self,
      value: int or float,
  ) -> None:
      """
      Validations for metric value
      Parameters
      ----------
      value
          metric value to be updated
      """
      if self.metric_type == MetricTypes.COUNTER and value < 0:
          raise ValueError(
              "Counter metric update value cannot be negative"
          )
  
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 3 for calling the CachingMetric obj's underlying member method code with example usage: obj._validate_metric_value(value) without return types