UploadMetricsController
public struct UploadMetricsController : RouteCollection
-
Declaration
Swift
public func boot(routes: RoutesBuilder) throws
-
Gets a Request to process a Log and enqueues it to be processed by
ProcessMetricsJob
asynchronously. Basically acts as a Fire & Forget endpoint, which is faster that the Sync option. If the Backend is started with the optionXCMETRICS_USE_ASYNC_LOG_PROCESSING
turned off, this endpoint will not be available (Returns a404
Throws
If the request is not a validUploadMetricsPayload
or there was an error storing the logDeclaration
Swift
public func create(req: Request) throws -> EventLoopFuture<HTTPStatus>
Parameters
req
Request with a valid
UploadMetricsPayload
Return Value
200
HTTP Status if everything is ok.400
if the request is not anUploadMetricsPayload
,404
if Async processing was turned off (XCMETRICS_USE_ASYNC_LOG_PROCESSING
=0)500
if there was an unexpected error -
Inserts the build metrics Synchronously which can be slow. Use only if the Async method is not available for instance, if running in CloudRun
Throws
If the request is not a validUploadMetricsPayload
or there was an error parsing the Logs or inserting them in the databaseDeclaration
Swift
public func createSync(req: Request) throws -> EventLoopFuture<HTTPStatus>
Parameters
req
Request with a valid
UploadMetricsPayload
Return Value
201
HTTP Status if everything is ok.400
if the request is not anUploadMetricsPayload
,500
if there was an unexpected error