diff --git a/app/Services/CollectorService.php b/app/Services/CollectorService.php index 8a2f5ac..1fc60f5 100644 --- a/app/Services/CollectorService.php +++ b/app/Services/CollectorService.php @@ -110,8 +110,8 @@ class CollectorService extends CommonService } // 이전 데이터를 조회하여 Rate 계산에 사용 $lastEntity = $this->model->getLastEntity($trafficEntity->getPK()); - $inKbitsSec = 0.0; - $outKbitsSec = 0.0; + $inKbitsSec = 0; + $outKbitsSec = 0; // 이전 데이터가 있어야만 Rate 계산 가능 if ($lastEntity !== null) { $lastTime = Time::parse($lastEntity->getCreatedAt())->getTimestamp(); @@ -120,7 +120,6 @@ class CollectorService extends CommonService // Raw Octets 값의 차분 계산 $deltaInOctets = $currentInOctets - $lastEntity->getRawIn(); $deltaOutOctets = $currentOutOctets - $lastEntity->getRawOut(); - // Kbit/s 계산: (Delta_Octets * 8 bits) / Delta_Time_Seconds / 1000 (-> Kbit/s) $inKbitsSec = ($deltaInOctets * 8) / $deltaTime / 1000; $outKbitsSec = ($deltaOutOctets * 8) / $deltaTime / 1000; @@ -131,8 +130,8 @@ class CollectorService extends CommonService // DB에 저장할 데이터를 배열로 반환 return [ 'trafficinfo_uid' => $trafficEntity->getPK(), - 'in' => round($inKbitsSec, 2), - 'out' => round($outKbitsSec, 2), + 'in' => $inKbitsSec, + 'out' => $outKbitsSec, 'raw_in' => $currentInOctets, 'raw_out' => $currentOutOctets, ];