StatisticsController
public struct StatisticsController : RouteCollection
Controller with endpoints that return statistics for build related data
-
Returns the routes supported by this Controller. All the routes are in the
v1/statisticspathThrows
AnErrorif something goes wrongDeclaration
Swift
public func boot(routes: RoutesBuilder) throwsParameters
routesRoutesBuilder to which the routes will be added
-
Endpoint that returns a list of
DayCountwhich includes the sum of errors and builds during a given day- Method:
GET - Route:
/v1/statistics/build/count?days=14 Request parameters
days. How many days to include in the past, starting from the current date
Response:
[ { "id": "2021-07-14", "builds": 197, "errors": 4, }, ... ]
Declaration
Swift
public func buildCounts(req: Request) throws -> EventLoopFuture<[DayCount]> - Method:
-
Endpoint that returns the paginated list of
BuildStatusResultto minimize payload size when many statuses are required- Method:
GET - Route:
/v1/statistics/build/status?page=1&per=10 Request parameters
page. Optional. Page number to fetch. Default is1per. Optional. Number of items to fetch per page. Default is10
Response:
{ "metadata": { "per": 10, "total": 100, "page": 2 }, "items": [ { "id": "MyMac_34580469-5792-40F3-BEFB-7C5925996F23_1", "buildStatus": "succeeded", }, ... ] }
Declaration
Swift
public func buildStatus(req: Request) throws -> EventLoopFuture<Page<BuildStatusResult>> - Method:
-
Endpoint that returns a list of
DayBuildTimewhich includes the build times for a number of procentiles of the builds and the total build time for each day, in seconds. ThedurationPXfields indicate that X % of the builds of the a day had a duration less or equal to the value.- Method:
GET - Route:
/v1/statistics/build/time?days=14 Request parameters
days. How many days to include in the past, starting from the current date
Response:
[ { "id": "2021-07-26", "durationP50": 18473.21, "durationP95": 54431313.32 "totalDuration": 10983982398.549, }, ... ]
Declaration
Swift
public func buildTimes(req: Request) throws -> EventLoopFuture<[DayBuildTime]> - Method: