captureJobStart static method
Implementation
static Future<String> captureJobStart(JobDetail jobDetail) async {
if (!jobDetail.isValid) {
LogService.logger.e(
'[Vigil] Error while creating start job record :: Both job id and slug cannot be empty');
return '[Vigil] Error while creating start job record :: Both job id and slug cannot be empty';
} else {
final startJobRequest = StartJob(
clientVersion: jobDetail.clientVersion ?? Vigil.version,
jobId: jobDetail.jobId,
jobSlug: jobDetail.jobSlug,
startMessage: jobDetail.message,
startTime: !LodashUtils.isEmpty(jobDetail.eventTime)
? jobDetail.eventTime!
: DateTime.now(),
jobRunId: jobDetail.jobRunId);
try {
await ApiService.makeApiCall(
Vigil.instanceUrl!,
RouteConstants.JOB_START_MONITORING,
startJobRequest.toJson(),
Vigil.apiKey);
LogService.logger.i('[Vigil] Job Start has been logged successfully');
return '[Vigil] Job Start has been logged successfully';
} catch (e) {
LogService.logger
.e('[Vigil] Error while creating start job record :: $e}');
return '[Vigil] Error while creating start job record :: $e}';
}
}
}