Skip to content
Snippets Groups Projects
Commit 11ff4ca3 authored by Thibault Debatty's avatar Thibault Debatty
Browse files

Log agent execution time

parent 5e64abf7
No related branches found
No related tags found
No related merge requests found
Pipeline #13415 passed
......@@ -46,6 +46,10 @@ class RunAgent implements ShouldQueue
*/
public function handle()
{
$label = $this->agent->config()->label;
logger()->info("Start agent $label for server #" . $this->record->server_id);
$start = microtime(true);
$trigger_label = $this->agent->config()->trigger_label;
$record = $this->record;
$server = $this->record->server;
......@@ -58,5 +62,8 @@ class RunAgent implements ShouldQueue
$report->label = $this->agent->config()->label;
$report->record_id = $record->id;
$report->save();
$runtime = round((microtime(true) - $start) * 1000);
logger()->info("End agent $label | Execution time: $runtime ms");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment