Merge pull request 'feat/push-monitoring-agent-v2' (#50) from feat/push-monitoring-agent-v2 into master

Reviewed-on: #50
This commit was merged in pull request #50.
This commit is contained in:
2026-06-11 20:43:53 -04:00

View File

@@ -300,7 +300,16 @@ class ApiController
public function pushMetrics(): void public function pushMetrics(): void
{ {
$input = json_decode(file_get_contents('php://input'), true); $rawBody = file_get_contents('php://input');
$input = json_decode($rawBody, true);
$logger = \ServerManager\Core\Logger::getInstance();
$logger->warning('Push metrics received', [
'input_keys' => $input ? array_keys($input) : [],
'has_agent_key' => !empty($input['agent_key']),
'agent_key_prefix' => isset($input['agent_key']) ? substr((string)$input['agent_key'], 0, 8) . '...' : 'none',
'raw_body_prefix' => substr($rawBody, 0, 200),
]);
if (!$input || empty($input['agent_key'])) { if (!$input || empty($input['agent_key'])) {
$this->view->json(['error' => 'agent_key is required'], 401); $this->view->json(['error' => 'agent_key is required'], 401);