Add more log details to execution
This commit is contained in:
parent
d7c5d8bb46
commit
69aa59a1d6
3 changed files with 53 additions and 0 deletions
|
@ -2920,6 +2920,39 @@ $collections = [
|
|||
'default' => null,
|
||||
'filters' => [],
|
||||
],
|
||||
[
|
||||
'array' => false,
|
||||
'$id' => ID::custom('method'),
|
||||
'type' => Database::VAR_STRING,
|
||||
'format' => '',
|
||||
'size' => 128,
|
||||
'signed' => true,
|
||||
'required' => false,
|
||||
'default' => null,
|
||||
'filters' => [],
|
||||
],
|
||||
[
|
||||
'array' => false,
|
||||
'$id' => ID::custom('path'),
|
||||
'type' => Database::VAR_STRING,
|
||||
'format' => '',
|
||||
'size' => 2048,
|
||||
'signed' => true,
|
||||
'required' => false,
|
||||
'default' => null,
|
||||
'filters' => [],
|
||||
],
|
||||
[
|
||||
'array' => false,
|
||||
'$id' => ID::custom('agent'),
|
||||
'type' => Database::VAR_STRING,
|
||||
'format' => '',
|
||||
'size' => 2048,
|
||||
'signed' => true,
|
||||
'required' => false,
|
||||
'default' => null,
|
||||
'filters' => [],
|
||||
],
|
||||
[
|
||||
'$id' => ID::custom('status'),
|
||||
'type' => Database::VAR_STRING,
|
||||
|
|
|
@ -1170,6 +1170,13 @@ App::post('/v1/functions/:functionId/executions')
|
|||
|
||||
$executionId = ID::unique();
|
||||
|
||||
$agent = '';
|
||||
foreach ($headers as $header => $value) {
|
||||
if(\strtolower($header) === 'user-agent') {
|
||||
$agent = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$execution = new Document([
|
||||
'$id' => $executionId,
|
||||
'$permissions' => !$user->isEmpty() ? [Permission::read(Role::user($user->getId()))] : [],
|
||||
|
@ -1184,6 +1191,9 @@ App::post('/v1/functions/:functionId/executions')
|
|||
'logs' => '',
|
||||
'duration' => 0.0,
|
||||
'search' => implode(' ', [$functionId, $executionId]),
|
||||
'path' => $path,
|
||||
'method' => $method,
|
||||
'agent' => $agent
|
||||
]);
|
||||
|
||||
if($function->getAttribute('logging')) {
|
||||
|
|
|
@ -80,6 +80,13 @@ Server::setResource('execute', function () {
|
|||
/** Create execution or update execution status */
|
||||
$execution = $dbForProject->getDocument('executions', $executionId ?? '');
|
||||
if ($execution->isEmpty()) {
|
||||
$agent = '';
|
||||
foreach ($headers as $header => $value) {
|
||||
if(\strtolower($header) === 'user-agent') {
|
||||
$agent = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$executionId = ID::unique();
|
||||
$execution = new Document([
|
||||
'$id' => $executionId,
|
||||
|
@ -93,6 +100,9 @@ Server::setResource('execute', function () {
|
|||
'logs' => '',
|
||||
'duration' => 0.0,
|
||||
'search' => implode(' ', [$functionId, $executionId]),
|
||||
'path' => $path,
|
||||
'method' => $method,
|
||||
'agent' => $agent
|
||||
]);
|
||||
|
||||
if($function->getAttribute('logging')) {
|
||||
|
|
Loading…
Reference in a new issue