2021-08-26 19:12:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
use Appwrite\Utopia\Response;
|
|
|
|
|
use Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
2021-08-27 16:45:08 +00:00
|
|
|
class UsageFunctions extends Model
|
2021-08-26 19:12:36 +00:00
|
|
|
{
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this
|
|
|
|
|
->addRule('range', [
|
|
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'The time range of the usage stats.',
|
|
|
|
|
'default' => '',
|
|
|
|
|
'example' => '30d',
|
|
|
|
|
])
|
2022-08-11 05:25:39 +00:00
|
|
|
->addRule('executionsTotal', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2022-08-11 05:25:39 +00:00
|
|
|
'description' => 'Aggregated stats for number of function executions.',
|
2021-08-26 19:12:36 +00:00
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-05-23 14:54:50 +00:00
|
|
|
'array' => true
|
2021-08-26 19:12:36 +00:00
|
|
|
])
|
2022-08-11 05:25:39 +00:00
|
|
|
->addRule('executionsFailure', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2021-08-26 19:12:36 +00:00
|
|
|
'description' => 'Aggregated stats for function execution failures.',
|
|
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-05-23 14:54:50 +00:00
|
|
|
'array' => true
|
2021-08-26 19:12:36 +00:00
|
|
|
])
|
2022-08-11 05:25:39 +00:00
|
|
|
->addRule('executionsSuccess', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2022-08-11 05:25:39 +00:00
|
|
|
'description' => 'Aggregated stats for function execution successes.',
|
2021-08-26 19:12:36 +00:00
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-05-23 14:54:50 +00:00
|
|
|
'array' => true
|
2021-08-26 19:12:36 +00:00
|
|
|
])
|
2022-08-11 05:25:39 +00:00
|
|
|
->addRule('executionsTime', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2022-07-17 10:30:58 +00:00
|
|
|
'description' => 'Aggregated stats for function execution duration.',
|
|
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-07-17 10:30:58 +00:00
|
|
|
'array' => true
|
|
|
|
|
])
|
2022-08-11 05:25:39 +00:00
|
|
|
->addRule('buildsTotal', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2022-08-11 05:25:39 +00:00
|
|
|
'description' => 'Aggregated stats for number of function builds.',
|
|
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-08-11 05:25:39 +00:00
|
|
|
'array' => true
|
|
|
|
|
])
|
|
|
|
|
->addRule('buildsFailure', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2022-08-11 05:25:39 +00:00
|
|
|
'description' => 'Aggregated stats for function build failures.',
|
|
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-08-11 05:25:39 +00:00
|
|
|
'array' => true
|
|
|
|
|
])
|
|
|
|
|
->addRule('buildsSuccess', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2022-08-11 05:25:39 +00:00
|
|
|
'description' => 'Aggregated stats for function build successes.',
|
|
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-08-11 05:25:39 +00:00
|
|
|
'array' => true
|
|
|
|
|
])
|
|
|
|
|
->addRule('buildsTime', [
|
2022-10-11 10:34:42 +00:00
|
|
|
'type' => Response::MODEL_METRIC,
|
2022-08-11 05:25:39 +00:00
|
|
|
'description' => 'Aggregated stats for function build duration.',
|
2022-07-17 10:30:58 +00:00
|
|
|
'default' => [],
|
2022-10-11 10:34:42 +00:00
|
|
|
'example' => [],
|
2022-07-17 10:30:58 +00:00
|
|
|
'array' => true
|
|
|
|
|
])
|
2021-08-26 19:12:36 +00:00
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Name
|
2022-05-23 14:54:50 +00:00
|
|
|
*
|
2021-08-26 19:12:36 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2022-05-23 14:54:50 +00:00
|
|
|
public function getName(): string
|
2021-08-26 19:12:36 +00:00
|
|
|
{
|
2021-08-27 16:45:08 +00:00
|
|
|
return 'UsageFunctions';
|
2021-08-26 19:12:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-08-27 16:45:08 +00:00
|
|
|
* Get Type
|
2022-05-23 14:54:50 +00:00
|
|
|
*
|
2021-08-26 19:12:36 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2022-05-23 14:54:50 +00:00
|
|
|
public function getType(): string
|
2021-08-26 19:12:36 +00:00
|
|
|
{
|
2021-08-27 16:45:08 +00:00
|
|
|
return Response::MODEL_USAGE_FUNCTIONS;
|
2021-08-26 19:12:36 +00:00
|
|
|
}
|
2022-05-23 14:54:50 +00:00
|
|
|
}
|