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
ProcessMetricsJobasynchronously. 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_PROCESSINGturned off, this endpoint will not be available (Returns a404Throws
If the request is not a validUploadMetricsPayloador there was an error storing the logDeclaration
Swift
public func create(req: Request) throws -> EventLoopFuture<HTTPStatus>Parameters
reqRequest with a valid
UploadMetricsPayloadReturn Value
200HTTP Status if everything is ok.400if the request is not anUploadMetricsPayload,404if Async processing was turned off (XCMETRICS_USE_ASYNC_LOG_PROCESSING=0)500if 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 validUploadMetricsPayloador there was an error parsing the Logs or inserting them in the databaseDeclaration
Swift
public func createSync(req: Request) throws -> EventLoopFuture<HTTPStatus>Parameters
reqRequest with a valid
UploadMetricsPayloadReturn Value
201HTTP Status if everything is ok.400if the request is not anUploadMetricsPayload,500if there was an unexpected error