/// <summary> /// Performs the job /// </summary> /// <param name="settings"></param> public async Task Run(RepositoryToScanSettings settings) { this.telemetryClient.TrackRecurringJobStarted(settings); if (settings == null) { throw new ArgumentNullException(nameof(settings)); } var arguments = this.mapper.Map <TransmitterArguments>(settings); RepositoryImportResult result = await this.projectInfoTransmitter.Work(arguments).ConfigureAwait(false); this.telemetryClient.TrackRecurringJobFinished(arguments, result); }
/// <summary> /// Ater execution finished /// </summary> /// <param name="telemetryClient"></param> /// <param name="arguments"></param> /// <param name="result"></param> /// <exception cref="ArgumentNullException"></exception> public static void TrackRecurringJobFinished(this TelemetryClient telemetryClient, TransmitterArguments arguments, RepositoryImportResult result) { if (telemetryClient == null) { throw new ArgumentNullException(nameof(telemetryClient)); } var props = GetProperties(arguments); props.Add(PropertyKeys.SuccessCount, result?.SuccessCount.ToString(CultureInfo.InvariantCulture)); props.Add(PropertyKeys.FailedCount, result?.FailedCount.ToString(CultureInfo.InvariantCulture)); telemetryClient.TrackEvent(Names.RecurringJobFinished, props); }