getLogAggregator()->queryVisitsByDimension(['idvisitor']); * while ($row = $query->fetch()) { * $label = $row['idvisitor']; * unset($row['idvisitor']); * $record->sumRowWithLabel($label, $row); * } * * return [self::EXAMPLEPLUGIN_ARCHIVE_RECORD => $record]; * ``` * * non-day periods will automatically be aggregated together */ protected function aggregate(ArchiveProcessor $archiveProcessor): array { $params = $archiveProcessor->getParams(); $records = []; // insert a test numeric metric that is the difference in days between the day we're archiving and // $this->daysFrom. $daysFrom = Date::factory($this->daysFrom); $date = $params->getPeriod()->getDateStart(); $differenceInSeconds = $daysFrom->getTimestamp() - $date->getTimestamp(); $differenceInDays = round($differenceInSeconds / 86400); $records[self::EXAMPLEPLUGIN_METRIC_NAME] = $differenceInDays; return $records; } }