protected function logToDWH($event_id, $filePath = null, $idleTime = null) { $event = new KBatchEvent(); $event->value_1 = $idleTime; $event->value_2 = $filePath; $event->batch_client_version = "1.0"; $event->batch_event_time = time(); $event->batch_event_type_id = $event_id; $event->batch_session_id = $this->config->sessionKey; $event->batch_id = $this->config->batchIndex; $event->batch_name = $this->config->batchName; $event->section_id = $this->config->workerId; $event->batch_type = $this->config->workerType; $event->location_id = $this->config->schedulerId; $event->host_name = $this->config->schedulerName; KDwhClient::send($event); }
protected function onEvent(KBatchEvent $event, KSchedularTaskConfig $taskConfig) { $event->batch_client_version = "1.0"; $event->batch_event_time = time(); $event->batch_name = $taskConfig->name; $event->section_id = $taskConfig->id; $event->batch_type = $taskConfig->type; $event->location_id = $this->schedulerConfig->getId(); $event->host_name = $this->schedulerConfig->getName(); KDwhClient::send($event); }
/** * @param int $event_id * @param KBatchEvent $event */ protected function onEvent($event_id, KBatchEvent $event = null) { if (is_null($event)) { $event = new KBatchEvent(); } $event->batch_client_version = "1.0"; $event->batch_event_time = time(); $event->batch_event_type_id = $event_id; $event->batch_session_id = $this->sessionKey; $event->batch_id = $this->getIndex(); $event->batch_name = $this->getName(); $event->section_id = $this->getId(); $event->batch_type = $this->getType(); $event->location_id = $this->getSchedulerId(); $event->host_name = $this->getSchedulerName(); KDwhClient::send($event); }
/** * * @package Scheduler * @subpackage Debug */ require_once dirname(__FILE__) . "/../KDwhClient.class.php"; require_once dirname(__FILE__) . "/../KBatchEvent.class.php"; KDwhClient::setFileName("/var/log/dwh/dwh_batch_events"); $param = $argv[1]; $loop_size = $argv[2]; $session_id = null; for ($i = 0; $i < $loop_size; $i++) { if ($i % 10 == 0) { $session_id = md5("abc" . time()); } $event = new KBatchEvent(); $event->batch_client_version = "123|{$param}"; $event->batch_event_time = time(); $event->batch_event_type_id = rand(1, 10); $event->batch_name = "import"; $event->batch_id = $i % 8; $event->batch_session_id = $session_id; $event->entry_id = rand(1000, 10000); $event->host_name = "host {$param}"; $event->location_id = "1"; $event->partner_id = rand(1, 10); $event->section_id = "1"; KDwhClient::send($event); usleep(200); }