public void Execute() { Telemetry.Current.TrackEvent("MigrationContextExecute", new Dictionary <string, string> { { "Name", Name }, { "Target Project", me.Target.Name }, { "Target Collection", me.Target.Collection.Name }, { "Source Project", me.Source.Name }, { "Source Collection", me.Source.Collection.Name } }); Trace.TraceInformation(" Migration Context Start {0} ", Name); var executeTimer = new Stopwatch(); executeTimer.Start(); ////////////////////////////////////////////////// try { Status = ProcessingStatus.Running; InternalExecute(); Status = ProcessingStatus.Complete; executeTimer.Stop(); Telemetry.Current.TrackEvent("MigrationContextComplete", new Dictionary <string, string> { { "Name", Name }, { "Target Project", me.Target.Name }, { "Target Collection", me.Target.Collection.Name }, { "Source Project", me.Source.Name }, { "Source Collection", me.Source.Collection.Name }, { "Status", Status.ToString() } }, new Dictionary <string, double> { { "MigrationContextTime", executeTimer.ElapsedMilliseconds } }); Trace.TraceInformation(" Migration Context Complete {0} ", Name); } catch (Exception ex) { Status = ProcessingStatus.Failed; executeTimer.Stop(); Telemetry.Current.TrackException(ex, new Dictionary <string, string> { { "Name", Name }, { "Target Project", me.Target.Name }, { "Target Collection", me.Target.Collection.Name }, { "Source Project", me.Source.Name }, { "Source Collection", me.Source.Collection.Name }, { "Status", Status.ToString() } }, new Dictionary <string, double> { { "MigrationContextTime", executeTimer.ElapsedMilliseconds } }); Trace.TraceWarning(" [EXCEPTION] {0}", ex.Message); throw ex; } }
/// <summary> /// Update an entity to a new status. /// </summary> /// <param name="entityId">Id of entity to update.</param> /// <param name="processingStatus">New status of entity.</param> public void UpdateEntity(Guid entityId, ProcessingStatus processingStatus) { var parms = new DynamicParameters(); parms.Add("@id", entityId); parms.Add("@processingStatus", processingStatus.ToString()); using (var conn = new SqlConnection(_connectionString)) { conn.Execute("dbo.UpdateEntity", parms, commandType: CommandType.StoredProcedure); } }
public TableProcessorLogEntry( EmailQueueToken token, int retryCount, ProcessingStatus status, DateTime startUtc, DateTime endUtc, string errorMessage) : base(token.RequestId.ToString(), retryCount.ToString()) { ErrorMessage = errorMessage; ProcessStartedUtc = startUtc; ProcessFinishedUtc = endUtc; Status = status.ToString(); RetryCount = retryCount; }
public void Execute() { Telemetry.Current.TrackPageView(this.Name); Trace.TraceInformation(" Migration Context Start {0} ", Name); var executeTimer = new Stopwatch(); DateTime start = DateTime.Now; executeTimer.Start(); ////////////////////////////////////////////////// try { Status = ProcessingStatus.Running; InternalExecute(); Status = ProcessingStatus.Complete; executeTimer.Stop(); Trace.TraceInformation(" Migration Context Complete {0} ", Name); } catch (Exception ex) { Status = ProcessingStatus.Failed; executeTimer.Stop(); Telemetry.Current.TrackException(ex, new Dictionary <string, string> { { "Name", Name }, { "Target Project", me.Target.Name }, { "Target Collection", me.Target.Collection.Name }, { "Source Project", me.Source.Name }, { "Source Collection", me.Source.Collection.Name }, { "Status", Status.ToString() } }, new Dictionary <string, double> { { "MigrationContextTime", executeTimer.ElapsedMilliseconds } }); Trace.TraceWarning($" [EXCEPTION] {ex}"); } finally { Telemetry.Current.TrackRequest(this.Name, start, executeTimer.Elapsed, Status.ToString(), (Status == ProcessingStatus.Complete)); } }
private void SetLabelOnTorrent(Torrent torrent, ProcessingStatus status) { // gui/?action=setprops&hash=[TORRENT HASH]&s=[PROPERTY]&v=[VALUE] var emptyLabelReq = new RestRequest($"gui/?action=setprops&hash={torrent.Hash}&s=label&v="); var setNewLabelReq = new RestRequest($"gui/?action=setprops&hash={torrent.Hash}&s=label&v={status.ToString()}"); _restClient.Execute(emptyLabelReq); var response = _restClient.Execute(setNewLabelReq); if (response.ResponseStatus != ResponseStatus.Completed || !IsSuccessStatusCode(response.StatusCode)) { throw new System.Exception($"Invalid response from Torrent WebApi. HttpStatus: {response.StatusCode} {response.StatusDescription}, Http: {response.ResponseStatus.ToString()}"); } torrent.ProcessingStatus = status; }