Skip to content

Commit

Permalink
Merge pull request #34 from Dynatrace/improve-rerun
Browse files Browse the repository at this point in the history
Rerun improvements
  • Loading branch information
discostu105 authored Mar 8, 2017
2 parents 7072a1a + 6cbc107 commit c38c80a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/SuperDumpService/Models/DumpMetainfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public enum SDFileType {
[Description("Results")]
DebugDiagResult,

[Description("Metadata")]
SuperDumpMetaData,

[Description("Logs")]
SuperDumpLogfile,

Expand Down
2 changes: 1 addition & 1 deletion src/SuperDumpService/Services/DumpStorageFilebased.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private SDFileEntry GetSDFileEntry(DumpMetainfo dumpInfo, FileInfo fileInfo) {
return fileEntry;
}
if (Path.GetFileName(pathHelper.GetDumpMetadataPath(dumpInfo.BundleId, dumpInfo.DumpId)) == fileInfo.Name) {
fileEntry.Type = SDFileType.SuperDumpData;
fileEntry.Type = SDFileType.SuperDumpMetaData;
return fileEntry;
}
if ("windbg.log" == fileInfo.Name) {
Expand Down
17 changes: 14 additions & 3 deletions src/SuperDumpService/Services/SuperDumpRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,18 @@ public DumpMetainfo GetDump(string bundleId, string dumpId) {

public void WipeAllExceptDump(string bundleId, string dumpId) {
var dumpdir = pathHelper.GetDumpDirectory(bundleId, dumpId);
var dumpfile = dumpRepo.GetDumpFilePath(bundleId, dumpId);
var knownfiles = dumpRepo.GetFileNames(bundleId, dumpId);
foreach (var file in Directory.EnumerateFiles(dumpdir)) {
if (file != dumpfile && file != pathHelper.GetDumpMetadataPath(bundleId, dumpId)) {
bool shallDelete = true;
var match = knownfiles.SingleOrDefault(x => x.FileInfo.FullName == file);
if (match != null) {
shallDelete = match.FileEntry.Type == SDFileType.SuperDumpData
|| match.FileEntry.Type == SDFileType.SuperDumpLogfile
|| match.FileEntry.Type == SDFileType.DebugDiagResult
|| match.FileEntry.Type == SDFileType.CustomTextResult
|| match.FileEntry.Type == SDFileType.WinDbg;
}
if (shallDelete) {
File.Delete(file);
}
}
Expand Down Expand Up @@ -123,7 +132,7 @@ private async Task ProcessZip(string bundleId, FileInfo zipfile) {
private async Task ProcessDump(string bundleId, FileInfo file) {
// add dump
var dumpInfo = await dumpRepo.CreateDump(bundleId, file);

// add other files within the same directory
await IncludeOtherFiles(bundleId, file, dumpInfo);

Expand All @@ -136,6 +145,8 @@ private async Task IncludeOtherFiles(string bundleId, FileInfo file, DumpMetainf
var dir = file.Directory;
foreach (var siblingFile in dir.EnumerateFiles()) {
if (siblingFile.FullName == file.FullName) continue; // don't add actual dump file twice
if (siblingFile.Name.EndsWith(".dmp", StringComparison.OrdinalIgnoreCase)) continue; // don't include other dumps from same dir
if (siblingFile.Name.EndsWith(".core.gz", StringComparison.OrdinalIgnoreCase)) continue; // don't include other dumps from same dir
await dumpRepo.AddFileCopy(bundleId, dumpInfo.DumpId, siblingFile, SDFileType.SiblingFile);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/SuperDumpService/Views/Home/Report.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<dt>Files:</dt>
<dd>
<dl class="dl-horizontal">
@{ var sequence = new List<string> { "Primary Dump", "Other files", "Logs", "Results" }; }
@{ var sequence = new List<string> { "Primary Dump", "Other files", "Metadata", "Logs", "Results" }; }
@foreach (var filetype in Model.Files.Select(x => Utility.GetEnumDescription(x.FileEntry.Type)).Distinct()
.OrderBy(x => sequence.IndexOf(x) < 0 ? int.MaxValue : sequence.IndexOf(x))) { // somewhat ugly hack to control the order of file categories
<dt class="filesize">@filetype.ToString()</dt>
Expand Down

0 comments on commit c38c80a

Please sign in to comment.