public LogProcessingMetadata(LogsetParsingRequest request)
 {
     Id                       = request.LogsetHash;
     Target                   = request.Target;
     TargetSize               = request.Target.Size;
     LogsetType               = request.ArtifactProcessor.ArtifactType;
     ProcessedSuccessfully    = false;
     ProcessingTimestamp      = request.CreationTimestamp;
     ProcessingTime           = GlobalEventTimingData.GetElapsedTime("Parsed Files", request.LogsetHash);
     User                     = Environment.UserName;
     Machine                  = Environment.MachineName;
     LogsharkVersion          = typeof(LogsharkRequestProcessor).Assembly.GetName().Version.ToString();
     ArtifactProcessorType    = request.ArtifactProcessor.GetType().Name;
     ArtifactProcessorVersion = request.ArtifactProcessor.GetType().Assembly.GetName().Version;
     CollectionsParsed        = new SortedSet <string>(request.CollectionsToParse);
 }
예제 #2
0
        public LogsharkRunMetadata(LogsharkRunContext run, int?id = null)
        {
            // Update record id if it was passed in.
            if (id.HasValue)
            {
                Id = id.Value;
            }

            // Request & target metadata.
            CustomId        = run.Request.CustomId;
            DatabaseName    = run.Request.PostgresDatabaseName;
            RunId           = run.Request.RunId;
            RunByUser       = Environment.UserName;
            RunByMachine    = Environment.MachineName;
            Source          = run.Request.Source;
            Target          = run.Request.Target;
            TargetSize      = run.Request.Target.Size;
            VersionLogshark = typeof(LogsharkRequestProcessor).Assembly.GetName().Version.ToString();

            // Timing metadata.
            FullRunStartTime               = run.Request.RequestCreationDate;
            FullRunElapsedSeconds          = (DateTime.UtcNow - run.Request.RequestCreationDate).TotalSeconds;
            LastMetadataUpdateTime         = DateTime.UtcNow;
            LogsetExtractionStartTime      = GlobalEventTimingData.GetStartTime("Unpack Archives");
            LogsetExtractionElapsedSeconds = GlobalEventTimingData.GetElapsedTime("Unpack Archives");
            LogParsingStartTime            = GlobalEventTimingData.GetStartTime("Parsed Files");
            LogParsingElapsedSeconds       = GlobalEventTimingData.GetElapsedTime("Parsed Files");
            PluginExecutionStartTime       = GlobalEventTimingData.GetStartTime("Executed Plugins");
            PluginExecutionElapsedSeconds  = GlobalEventTimingData.GetElapsedTime("Executed Plugins");

            // Context metadata.
            CurrentProcessingPhase = run.CurrentPhase.ToString();
            CustomMetadataRecords  = GetCustomMetadataRecords(run.Request);
            IsValidLogset          = run.IsValidLogset;

            // Initialization metadata.
            if (run.InitializationResult != null)
            {
                LogsetHash      = run.InitializationResult.LogsetHash;
                LogsetType      = run.InitializationResult.ArtifactProcessor.ArtifactType;
                PluginsExecuted = GetExecutedPluginsString(run.InitializationResult);
            }

            // Parsing metadata.
            if (run.ParsingResult != null)
            {
                TargetProcessedSize        = run.ParsingResult.ParsedDataVolumeBytes;
                UtilizedExistingLogsetHash = run.ParsingResult.UtilizedExistingProcessedLogset;
            }

            // Plugin execution metadata.
            if (run.PluginExecutionResult != null)
            {
                ContainsSuccessfulPluginExecution = run.PluginExecutionResult.PluginResponses.Any(pluginResponse => pluginResponse.SuccessfulExecution);
                PluginExecutionMetadataRecords    = GetPluginExecutionMetadataRecords(run.PluginExecutionResult);
                PluginsFailed = String.Join(",", run.PluginExecutionResult.PluginResponses.Where(pluginResponse => !pluginResponse.SuccessfulExecution));
                PublishedWorkbookMetadataRecords = GetPublishedWorkbookMetadataRecords(run.PluginExecutionResult, run.Request.Configuration.TableauConnectionInfo);
            }

            // Outcome metadata.
            IsRunSuccessful = run.IsRunSuccessful;
            if (run.CurrentPhase == ProcessingPhase.Complete)
            {
                IsRunComplete = true;
            }
            RunFailureExceptionType = run.RunFailureExceptionType;
            if (run.RunFailurePhase.HasValue)
            {
                RunFailurePhase = run.RunFailurePhase.ToString();
            }
            RunFailureReason = run.RunFailureReason;
        }