/** * Backfill a metric up to the most recent data sample * * @param Metric $metric * @param float $value */ public function backfill(Metric $metric, $value) { for ($timestamp = $metric->getMostRecentDataAt()->getTimestamp(); $timestamp <= time(); $timestamp += DataCollector::SAMPLES_INTERVAL) { $this->endpoint->persist(Data::fromUnixTimestamp($timestamp, $value)); } }