code: public void addMetric(final IMetric<?> metric) {
      // metric null or already present
      if (metric == null) {
        throw new IllegalArgumentException("Cannot add a null metric");
      }
  
      if (getMetricFromName(metric.getName()) == null) {
        logger.debug(String.format("Adding %s metric in Metric Manager", metric.getName()));
        this.metrics.add(metric);
        metric.updateMetricManager(this);
      } else {
        logger.error("Failed to add metric");
      }
    }
docs: Add a metric to be managed by Metric Manager