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); } }