private static void HandleTaskStarted( TaskStartedEvent e) { var diagnosticsLog = new DiagnosticsLog( DiagnosticsProvider.GetGlobalDiagnostic(), DiagnosticsProvider.GetFirstDiagnostic()); var log = new TaskExecutionLog(diagnosticsLog); log.TaskDuration.SetStart(e.Timestamp); e.Task.SetExecutionLog(log); }
private static void TryAddDiagnostic( DateTime timestamp, TaskExecutionLog log, bool isLastDiagnostic = false) { var diagnosticsLog = log.DiagnosticsLog; var latestDiagnostic = diagnosticsLog.GetLatestDiagnostic(); if (isLastDiagnostic && diagnosticsLog.HasFirstDiagnosticOnly() || timestamp - latestDiagnostic.Timestamp >= DiagnosticMinInterval) { var diagnostic = DiagnosticsProvider.GetDiagnostic(latestDiagnostic); diagnosticsLog.AddDiagnostic(diagnostic); } }