Perform a check.

@param \Rubix\ML\Estimator $estimator
@param \Rubix\ML\CrossValidation\Metrics\Metric $metric
@throws \InvalidArgumentException
333269
public static function check(Estimator $estimator, Metric $metric) : void
    {
        if (!in_array($estimator->type(), $metric->compatibility())) {
            throw new InvalidArgumentException(Params::shortName($metric)
                . ' is not compatible with '
                . Estimator::TYPES[$estimator->type()] . 's.');
        }
    }
489430
protected function getMetricIndicator(AbstractMetric $metric)
    {
        switch ($metric->getType()) {
            case Set::TYPE:       return 's';
            case Gauge::TYPE:     return 'g';
            case Timer::TYPE:     return 'ms';
            case Counter::TYPE:   return 'c';
            case Histogram::TYPE: return 'h';

            default:
                throw new \InvalidArgumentException('Metric type is not a valid DataDog metric: '.$metric->getType());
        }
    }
507079
@Override
  public void notifyManager() {
    logger.debug(String.format("Notifying Manager for %s", this.getClass().getName()));
    try {
      this.metricManager.reportMetric(this);
    } catch (final Throwable ex) {
      logger.error(
          String.format("Metric Manager is not set for %s metric", this.getClass().getName()), ex);
    }
  }
587378
public function getMetricValuesByRev($resultClass, $metric)
    {
        return array_map(function ($value) {
            return $value / $this->getRevolutions();
        }, $this->getMetricValues($resultClass, $metric));
    }
521967
public function counter($metric, $count = 1, array $tags = array(), $sampleRate = AbstractMetric::DEFAULT_SAMPLE_RATE)
    {
        return new Counter($this->prefix($metric), $count, array_merge($this->defaultTags, $tags), $sampleRate);
    }
293892
private void timing(String metric, Date startDate) {
        m_logger.trace("Time for '{}': {}", metric,
                       ((new Date()).getTime() - startDate.getTime()) + " millis");
    }
949426
public function send(AbstractMetric $metric)
    {
        $message = $this->getMetricMessage($metric);
        $this->flush($message);
    }
147630
def _raise_error_evaluation_metric_is_valid(metric, allowed_metrics):
    

    err_msg = "Evaluation metric '%s' not recognized. The supported evaluation"
    err_msg += " metrics are (%s)."

    if metric not in allowed_metrics:
      raise ToolkitError(err_msg % (metric,
                          ', '.join(map(lambda x: "'%s'" % x, allowed_metrics))))
1037839
public function sendMetric(Metric $metric) {
        $points = $metric->getPoints();
        if (empty($points)) {
            throw new EmptyMetricException('The metric must contain points to send');
        }

        $this->sendSeries(new Series($metric));

        return $this;
    }
1031773
public function update(Metric $metric, MetricPoint $metricPoint)
    {
        $metricPoint = execute(new UpdateMetricPointCommand(
            $metricPoint,
            $metric,
            Binput::get('value'),
            Binput::get('timestamp')
        ));

        return $this->item($metricPoint);
    }
637813
protected function assertConfiguration(BuilderConfigurator $configurator): void
    {
        $schemaDirectory = $configurator->getSchemaDirectory();
        $outputDirectory = $configurator->getOutputDirectory();
        $templateDirectory = $configurator->getTemplateDirectory();

        $requiredPaths = [
            'schema' => $schemaDirectory,
            'output' => $outputDirectory,
            'template' => $templateDirectory,
        ];

        foreach ($requiredPaths as $type => $path) {
            if (!\is_dir($path)) {
                throw new \InvalidArgumentException(\sprintf(
                    'Required %s directory does not exist under path: %s',
                    $type,
                    $path
                ));
            }
        }
    }
1209813
@Override
    public void submitMetric(PrincipalUser submitter, Metric metric) {
        submitMetrics(submitter, Arrays.asList(new Metric[] { metric }));
    }
804219
public static void register(MetricsRegistry metricsRegistry) {
        checkNotNull(metricsRegistry, "metricsRegistry");

        ClassLoadingMXBean mxBean = ManagementFactory.getClassLoadingMXBean();

        metricsRegistry.register(mxBean, "classloading.loadedClassesCount", MANDATORY, ClassLoadingMXBean::getLoadedClassCount);

        metricsRegistry.register(mxBean, "classloading.totalLoadedClassesCount", MANDATORY,
                ClassLoadingMXBean::getTotalLoadedClassCount);

        metricsRegistry.register(mxBean, "classloading.unloadedClassCount", MANDATORY, ClassLoadingMXBean::getUnloadedClassCount);
    }
666742
public function gauge($metric, $level, array $tags = array(), $sampleRate = AbstractMetric::DEFAULT_SAMPLE_RATE)
    {
        try {
            $this->sendMetric($this->metricFactory->gauge($metric, $level, $tags, $sampleRate));
        } catch (\Exception $exception) {
            $this->logException($exception);
        }

        return $this;
    }
1337342
public void setMetric(String metric) {
        SystemAssert.requireArgument(metric != null && !metric.isEmpty(), "Metric cannot be null or empty.");
        this.metric = metric;
    }
471818
public function setMetric($metric)
  {
    if (ThrottlerHelper::validateMetric($metric, self::$timeFactor)
        && !$this->isActive())
    {
      $this->metric = strtolower($metric);
      return true;
    }
    return false;
  }
1277915
public function store(Metric $metric)
    {
        try {
            $metricPoint = execute(new CreateMetricPointCommand(
                $metric,
                Binput::get('value'),
                Binput::get('timestamp')
            ));
        } catch (QueryException $e) {
            throw new BadRequestHttpException();
        }

        return $this->item($metricPoint);
    }