You are here

protected function SolrDiskUsageSensorPlugin::getSolrIndexSize in Monitoring 8

Returns the Solr index size.

Return value

mixed|null Returns the Solr index size.

2 calls to SolrDiskUsageSensorPlugin::getSolrIndexSize()
SolrDiskUsageSensorPlugin::resultVerbose in src/Plugin/monitoring/SensorPlugin/SolrDiskUsageSensorPlugin.php
Provide additional info about sensor call.
SolrDiskUsageSensorPlugin::runSensor in src/Plugin/monitoring/SensorPlugin/SolrDiskUsageSensorPlugin.php
Runs the sensor, updating $sensor_result.

File

src/Plugin/monitoring/SensorPlugin/SolrDiskUsageSensorPlugin.php, line 222

Class

SolrDiskUsageSensorPlugin
Monitors the Solr disk usage.

Namespace

Drupal\monitoring\Plugin\monitoring\SensorPlugin

Code

protected function getSolrIndexSize() {
  $index_size = NULL;

  // Condition is used to simulate data for purpose of testing.
  if ($data = $this->state
    ->get('monitoring.test_solr_index_size')) {
    $index_size = $data;
  }
  elseif ($server = $this
    ->getSolrServer()) {
    $index_size = $server
      ->getBackend()
      ->getSolrConnector()
      ->getStatsSummary()['@index_size'];
  }
  return $index_size;
}