You are here

protected function SensorResult::assessThresholds in Monitoring 8

Same name and namespace in other branches
  1. 7 lib/Drupal/monitoring/Result/SensorResult.php \Drupal\monitoring\Result\SensorResult::assessThresholds()

Deal with thresholds.

Set the sensor value based on threshold configuration.

Return value

string The message associated with the threshold.

See also

\Drupal\monitoring\Sensor\Thresholds

1 call to SensorResult::assessThresholds()
SensorResult::compile in src/Result/SensorResult.php
Compiles added status messages sets the status.

File

src/Result/SensorResult.php, line 298

Class

SensorResult
Generic container for the sensor result.

Namespace

Drupal\monitoring\Result

Code

protected function assessThresholds() {
  $thresholds = new Thresholds($this->sensorConfig);
  $matched_threshold = $thresholds
    ->getMatchedThreshold($this
    ->getValue());

  // Set sensor status based on matched threshold.
  $this
    ->setStatus($matched_threshold);

  // @todo why not just set the status message?
  return $thresholds
    ->getStatusMessage();
}