From b96a45fdb7fdbfc0df57b005732ad68b21089ae1 Mon Sep 17 00:00:00 2001 From: Adam Congdon Date: Tue, 17 Oct 2023 08:41:36 -0400 Subject: [PATCH] performance tuning individual job details - WIP --- .../Reporting/Html/VBR/CHtmlBodyHelper.cs | 4 +- .../Reporting/Html/VBR/CHtmlCompiler.cs | 8 + .../IndividualJobSessionsHelper.cs | 189 ++++++++++-------- vHC/HC_Reporting/VeeamHealthCheck.csproj | 4 +- 4 files changed, 120 insertions(+), 85 deletions(-) diff --git a/vHC/HC_Reporting/Functions/Reporting/Html/VBR/CHtmlBodyHelper.cs b/vHC/HC_Reporting/Functions/Reporting/Html/VBR/CHtmlBodyHelper.cs index e948229..7a29491 100644 --- a/vHC/HC_Reporting/Functions/Reporting/Html/VBR/CHtmlBodyHelper.cs +++ b/vHC/HC_Reporting/Functions/Reporting/Html/VBR/CHtmlBodyHelper.cs @@ -39,7 +39,7 @@ public string FormVbrFullReport(string htmlString, bool scrub) if (CGlobals.EXPORTINDIVIDUALJOBHTMLS) { - IndividualJobHtmlBuilder(); + //IndividualJobHtmlBuilder(); } @@ -145,7 +145,7 @@ private void JobInfoTable() HTMLSTRING += _tables.AddJobInfoTable(SCRUB); } - private void IndividualJobHtmlBuilder() + public void IndividualJobHtmlBuilder() { _tables.AddSessionsFiles(SCRUB); } diff --git a/vHC/HC_Reporting/Functions/Reporting/Html/VBR/CHtmlCompiler.cs b/vHC/HC_Reporting/Functions/Reporting/Html/VBR/CHtmlCompiler.cs index 84faf8b..880124c 100644 --- a/vHC/HC_Reporting/Functions/Reporting/Html/VBR/CHtmlCompiler.cs +++ b/vHC/HC_Reporting/Functions/Reporting/Html/VBR/CHtmlCompiler.cs @@ -194,6 +194,14 @@ private void FormVbrFullBody() _htmldocScrubbed = helper.FormVbrFullReport(_htmldocScrubbed, true); _htmldocOriginal = helper.FormVbrFullReport(_htmldocOriginal, false); + if (CGlobals.EXPORTINDIVIDUALJOBHTMLS) + { + helper.IndividualJobHtmlBuilder(); + + //IndividualJobHtmlBuilder(); + + } + _htmldocOriginal += FormFooter(); _htmldocScrubbed += FormFooter(); diff --git a/vHC/HC_Reporting/Functions/Reporting/Html/VBR/VbrTables/Job Session Summary/IndividualJobSessionsHelper.cs b/vHC/HC_Reporting/Functions/Reporting/Html/VBR/VbrTables/Job Session Summary/IndividualJobSessionsHelper.cs index c717511..4effca2 100644 --- a/vHC/HC_Reporting/Functions/Reporting/Html/VBR/VbrTables/Job Session Summary/IndividualJobSessionsHelper.cs +++ b/vHC/HC_Reporting/Functions/Reporting/Html/VBR/VbrTables/Job Session Summary/IndividualJobSessionsHelper.cs @@ -1,4 +1,5 @@ -using System; +using Markdig.Extensions.SmartyPants; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -34,7 +35,7 @@ private List ReturnJobSessionsList() return csv; else { - csv = res.Where(c => c.CreationTime >= targetDate).ToList(); + csv = res.Where(c => c.CreationTime >= targetDate).ToList(); //csv = csv.Where(c => c.CreationTime >= targetDate).ToList(); csv = csv.OrderBy(x => x.Name).ToList(); @@ -47,7 +48,8 @@ private List ReturnJobSessionsList() public void ParseIndividualSessions(bool scrub) { - if (scrub) { _scrubber = new(); } + //if (scrub) { _scrubber = new(); } + _scrubber = new(); List processedJobs = new(); double percentCounter = 0; @@ -60,55 +62,22 @@ public void ParseIndividualSessions(bool scrub) { processedJobs.Add(cs.JobName); - string outDir = "";// CVariables.desiredDir + "\\Original"; + // string outDir = "";// CVariables.desiredDir + "\\Original"; string folderName = "\\JobSessionReports"; + string mainDir = SetMainDir(folderName, cs); + string scrubDir = SetScrubDir(folderName, cs); + if (cs.JobName.Contains("/")) { - log.Debug("Caught invalid char: \"/\", replacing with \"-\": " + cs.JobName); - cs.JobName = cs.JobName.Replace("/", "-"); - log.Debug("New Name = " + cs.JobName); - } - - if (scrub) - { - outDir = CGlobals._desiredPath + CVariables._safeSuffix + folderName; - //log.Warning("SAFE outdir = " + outDir, false); - CheckFolderExists(outDir); - outDir += "\\" + _scrubber.ScrubItem(cs.JobName) + ".html"; + cs.JobName = FixInvalidJobName(cs.JobName); } - else - { - outDir = CGlobals._desiredPath + CVariables._unsafeSuffix + folderName; - CheckFolderExists(outDir); - outDir += "\\" + cs.JobName + ".html"; - } - string docName = outDir + "\\"; - - - string s = _form.FormHeader(); - s += "

" + cs.JobName + "

"; - - s += ""; - s += _form.TableHeader("Job Name", "Name of job"); - s += _form.TableHeader("VM Name", "Name of VM/Server within the job"); - s += _form.TableHeader("Alg", "Job Algorithm"); - s += _form.TableHeader("Primary Bottleneck", "Primary detected bottleneck"); - s += _form.TableHeader("BottleNeck", "Detected bottleneck breakdown"); - s += _form.TableHeader("CompressionRatio", "Calculated compression ratio"); - s += _form.TableHeader("Start Time", "Start time of the backup job"); - s += _form.TableHeader("BackupSize", "Detected size of backup file"); - s += _form.TableHeader("DataSize", "Detected size of original VM/server (provisioned, not actual)"); - s += _form.TableHeader("DedupRatio", "Calculated deduplication ratio"); - s += _form.TableHeader("Is Retry", "Is this a retry run?"); - s += _form.TableHeader("Job Duration", "Duration of job in minutes"); - s += _form.TableHeader("Min Time", "Shorted detected job duration in minutes"); - s += _form.TableHeader("Max Time", "Longest detected job duration in minutes"); - s += _form.TableHeader("Avg Time", "Average job duration in minutes"); - s += _form.TableHeader("Processing Mode", "Processing mode used in the job (blank = SAN)"); - s += _form.TableHeader("Status", "Final status of the job"); - s += _form.TableHeader("Task Duration", "Duration of the VM/server within the job in minutes"); - s += ""; + +// string docName = outDir + "\\"; + + + string mainString = ReturnTableHeaderString(cs); + string scrubString = ReturnTableHeaderString(cs); int counter = 1; foreach (var c in csv) @@ -120,39 +89,8 @@ public void ParseIndividualSessions(bool scrub) { if (cs.JobName == c.JobName) { - string jname = c.JobName; - if (jname.Contains("\\")) - { - jname = jname.Replace("\\", "--"); - } - string vmName = c.VmName; - //string repo = _scrubber.ScrubItem(c.) - if (scrub) - { - jname = _scrubber.ScrubItem(c.JobName, "job"); - vmName = _scrubber.ScrubItem(c.VmName, "vm"); - } - - s += ""; - s += TableData(jname, "jobName"); - s += TableData(vmName, "vmName"); - s += TableData(c.Alg, "alg"); - s += TableData(c.PrimaryBottleneck, "primBottleneck"); - s += TableData(c.Bottleneck, "bottleneck"); - s += TableData(c.CompressionRatio, "compression"); - s += TableData(c.CreationTime.ToString(), "creationtime"); - s += TableData(c.BackupSize.ToString(), "backupsize"); - s += TableData(c.DataSize.ToString(), "datasize"); - s += TableData(c.DedupRatio, "dedupratio"); - s += TableData(c.IsRetry, "isretry"); - s += TableData(c.JobDuration, "jobDuration"); - s += TableData(c.minTime.ToString(), "minTime"); - s += TableData(c.maxTime.ToString(), "maxtime"); - s += TableData(c.avgTime.ToString(), "avgTime"); - s += TableData(c.ProcessingMode, "processingmode"); - s += TableData(c.Status, "status"); - s += TableData(c.TaskDuration, "taskDuration"); - s += ""; + mainString += FormHtmlString(c, mainString, false); + scrubString += FormHtmlString(c, scrubString, true); } } @@ -167,7 +105,8 @@ public void ParseIndividualSessions(bool scrub) //string dir = Path.GetDirectoryName(docName); //if (!Directory.Exists(dir)) // Directory.CreateDirectory(dir); - File.WriteAllText(outDir, s); + File.WriteAllText(mainDir, mainString); + File.WriteAllText(scrubDir, scrubString); } catch (Exception e) { @@ -181,6 +120,94 @@ public void ParseIndividualSessions(bool scrub) percentCounter++; } } + private string SetMainDir(string folderName, CJobSessionInfo cs) + { + var mainDir = CGlobals._desiredPath + CVariables._unsafeSuffix + folderName; + CheckFolderExists(mainDir); + mainDir += "\\" + cs.JobName + ".html"; + return mainDir; + } + private string SetScrubDir(string folderName, CJobSessionInfo cs) + { + var scrubDir = CGlobals._desiredPath + CVariables._safeSuffix + folderName; + //log.Warning("SAFE outdir = " + outDir, false); + CheckFolderExists(scrubDir); + scrubDir += "\\" + _scrubber.ScrubItem(cs.JobName) + ".html"; + return scrubDir; + } + private string ReturnTableHeaderString(CJobSessionInfo cs) + { + string s = _form.FormHeader(); + s += "

" + cs.JobName + "

"; + + s += "
"; + s += _form.TableHeader("Job Name", "Name of job"); + s += _form.TableHeader("VM Name", "Name of VM/Server within the job"); + s += _form.TableHeader("Alg", "Job Algorithm"); + s += _form.TableHeader("Primary Bottleneck", "Primary detected bottleneck"); + s += _form.TableHeader("BottleNeck", "Detected bottleneck breakdown"); + s += _form.TableHeader("CompressionRatio", "Calculated compression ratio"); + s += _form.TableHeader("Start Time", "Start time of the backup job"); + s += _form.TableHeader("BackupSize", "Detected size of backup file"); + s += _form.TableHeader("DataSize", "Detected size of original VM/server (provisioned, not actual)"); + s += _form.TableHeader("DedupRatio", "Calculated deduplication ratio"); + s += _form.TableHeader("Is Retry", "Is this a retry run?"); + s += _form.TableHeader("Job Duration", "Duration of job in minutes"); + s += _form.TableHeader("Min Time", "Shorted detected job duration in minutes"); + s += _form.TableHeader("Max Time", "Longest detected job duration in minutes"); + s += _form.TableHeader("Avg Time", "Average job duration in minutes"); + s += _form.TableHeader("Processing Mode", "Processing mode used in the job (blank = SAN)"); + s += _form.TableHeader("Status", "Final status of the job"); + s += _form.TableHeader("Task Duration", "Duration of the VM/server within the job in minutes"); + s += ""; + return s; + } + private string FormHtmlString(CJobSessionInfo c, string htmlString, bool scrub) + { + string s = ""; // htmlString; + string jname = c.JobName; + if (jname.Contains("\\")) + { + jname = jname.Replace("\\", "--"); + } + string vmName = c.VmName; + //string repo = _scrubber.ScrubItem(c.) + if (scrub) + { + jname = _scrubber.ScrubItem(c.JobName, "job"); + vmName = _scrubber.ScrubItem(c.VmName, "vm"); + } + + s += ""; + s += TableData(jname, "jobName"); + s += TableData(vmName, "vmName"); + s += TableData(c.Alg, "alg"); + s += TableData(c.PrimaryBottleneck, "primBottleneck"); + s += TableData(c.Bottleneck, "bottleneck"); + s += TableData(c.CompressionRatio, "compression"); + s += TableData(c.CreationTime.ToString(), "creationtime"); + s += TableData(c.BackupSize.ToString(), "backupsize"); + s += TableData(c.DataSize.ToString(), "datasize"); + s += TableData(c.DedupRatio, "dedupratio"); + s += TableData(c.IsRetry, "isretry"); + s += TableData(c.JobDuration, "jobDuration"); + s += TableData(c.minTime.ToString(), "minTime"); + s += TableData(c.maxTime.ToString(), "maxtime"); + s += TableData(c.avgTime.ToString(), "avgTime"); + s += TableData(c.ProcessingMode, "processingmode"); + s += TableData(c.Status, "status"); + s += TableData(c.TaskDuration, "taskDuration"); + s += ""; + + return s; + } + private string FixInvalidJobName(string jobName) + { + log.Debug("Caught invalid char: \"/\", replacing with \"-\": " + jobName); + var name = jobName.Replace("/", "-"); + log.Debug("New Name = " + name); + return name; + } private void LogJobSessionParseProgress(double counter, int total) { double percentComplete = counter / total * 100; diff --git a/vHC/HC_Reporting/VeeamHealthCheck.csproj b/vHC/HC_Reporting/VeeamHealthCheck.csproj index db8d1cd..58894a9 100644 --- a/vHC/HC_Reporting/VeeamHealthCheck.csproj +++ b/vHC/HC_Reporting/VeeamHealthCheck.csproj @@ -11,11 +11,11 @@ VeeamAdamCVeeam_HealthCheck_228x228.ico - 1.0.3.765 + 1.0.3.770Falsevhc_keyfile2.pfxfalse - 1.0.3.765 + 1.0.3.770fulltrue