code: public synchronized void startReporting(final String reporterName, final Props props) {
      final String metricsReporterClassName = props.get(CUSTOM_METRICS_REPORTER_CLASS_NAME);
      final String metricsServerURL = props.get(METRICS_SERVER_URL);
      if (metricsReporterClassName != null && metricsServerURL != null) {
        try {
          log.info("metricsReporterClassName: " + metricsReporterClassName);
          final Class metricsClass = Class.forName(metricsReporterClassName);
  
          final Constructor[] constructors = metricsClass.getConstructors();
          constructors[0].newInstance(reporterName, this.registry, metricsServerURL);
  
        } catch (final Exception e) {
          log.error("Encountered error while loading and instantiating "
              + metricsReporterClassName, e);
          throw new IllegalStateException("Encountered error while loading and instantiating "
              + metricsReporterClassName, e);
        }
      } else {
        log.error(String.format("No value for property: %s or %s was found",
            CUSTOM_METRICS_REPORTER_CLASS_NAME, METRICS_SERVER_URL));
      }
    }
docs: reporting metrics to remote metrics collector. Note: this method must be synchronized, since
  both web server and executor will call it during initialization.