public PluginTabPagePresenter(
            IView view,
            IPostprocessorsManager postprocessorsManager,
            IPostprocessorOutputFormFactory outputFormsFactory,
            ILogSourcesManager logSourcesManager,
            ITempFilesManager tempFiles,
            IShellOpen shellOpen,
            NewLogSourceDialog.IPresenter newLogSourceDialog,
            Telemetry.ITelemetryCollector telemetry
            )
        {
            this.view = view;
            this.view.SetEventsHandler(this);
            this.postprocessorsManager = postprocessorsManager;
            this.outputFormsFactory    = outputFormsFactory;
            this.tempFiles             = tempFiles;
            this.shellOpen             = shellOpen;
            this.newLogSourceDialog    = newLogSourceDialog;
            this.telemetry             = telemetry;

            logSourcesManager.OnLogSourceAnnotationChanged += (sender, e) =>
            {
                RefreshView();
            };
        }
        private void InitAndAddProstprocessorHandler(
            Dictionary <ViewControlId, IViewControlHandler> handlers,
            ViewControlId postprocessorViewId,
            IPostprocessorsManager postprocessorsManager,
            IPostprocessorOutputFormFactory outputFormsFactory,
            string postprocessorId
            )
        {
            IViewControlHandler handler;

            if (postprocessorViewId == ViewControlId.Correlate)
            {
                handler = new CorrelatorPostprocessorControlHandler(
                    postprocessorsManager,
                    tempFiles,
                    shellOpen
                    );
            }
            else
            {
                handler = new LogSourcePostprocessorControlHandler(
                    postprocessorsManager,
                    postprocessorId,
                    () => outputFormsFactory.GetPostprocessorOutputForm(postprocessorViewId),
                    shellOpen,
                    tempFiles
                    );
            }
            handlers.Add(postprocessorViewId, handler);
        }
Ejemplo n.º 3
0
        public PostprocessorsInitializer(
            IPostprocessorsManager postprocessorsManager,
            IUserDefinedFormatsManager userDefinedFormatsManager,
            StateInspector.IPostprocessorsFactory stateInspectorPostprocessorsFactory,
            TimeSeries.IPostprocessorsFactory timeSeriesPostprocessorsFactory
            )
        {
            Func <string, UDF> findFormat = formatName =>
            {
                var ret = userDefinedFormatsManager.Items.FirstOrDefault(
                    f => f.CompanyName == "Google" && f.FormatName == formatName) as UDF;
                if (ret == null)
                {
                    throw new Exception(string.Format("Log format {0} is not registered in LogJoint", formatName));
                }
                return(ret);
            };

            this.chromeDebugLogFormat      = findFormat("Chrome debug log");
            this.webRtcInternalsDumpFormat = findFormat("Chrome WebRTC internals dump as log");

            this.chromeDebugLogMeta = new LogSourceMetadata(
                chromeDebugLogFormat,
                stateInspectorPostprocessorsFactory.CreateChromeDebugPostprocessor(),
                timeSeriesPostprocessorsFactory.CreateChromeDebugPostprocessor()
                );
            postprocessorsManager.RegisterLogType(this.chromeDebugLogMeta);

            this.webRtcInternalsDumpMeta = new LogSourceMetadata(
                webRtcInternalsDumpFormat,
                stateInspectorPostprocessorsFactory.CreateWebRtcInternalsDumpPostprocessor(),
                timeSeriesPostprocessorsFactory.CreateWebRtcInternalsDumpPostprocessor()
                );
            postprocessorsManager.RegisterLogType(this.webRtcInternalsDumpMeta);
        }
Ejemplo n.º 4
0
        public PostprocessorsInitializer(
            IPostprocessorsManager postprocessorsManager,
            IUserDefinedFormatsManager userDefinedFormatsManager,
            StateInspector.IPostprocessorsFactory stateInspectorPostprocessorsFactory,
            TimeSeries.IPostprocessorsFactory timeSeriesPostprocessorsFactory,
            Correlator.IPostprocessorsFactory correlatorPostprocessorsFactory,
            Timeline.IPostprocessorsFactory timelinePostprocessorsFactory
            )
        {
            Func <string, string, UDF> findFormat = (company, formatName) =>
            {
                var ret = userDefinedFormatsManager.Items.FirstOrDefault(
                    f => f.CompanyName == company && f.FormatName == formatName) as UDF;
                if (ret == null)
                {
                    throw new Exception(string.Format("Log format {0} is not registered in LogJoint", formatName));
                }
                return(ret);
            };

            this.chromeDebugLogFormat      = findFormat("Google", "Chrome debug log");
            this.webRtcInternalsDumpFormat = findFormat("Google", "Chrome WebRTC internals dump as log");
            this.chromeDriverLogFormat     = findFormat("Google", "chromedriver");
            this.symRtcLogFormat           = findFormat("Symphony", "RTC log");

            var correlatorPostprocessorType = correlatorPostprocessorsFactory.CreatePostprocessor(this);

            postprocessorsManager.RegisterCrossLogSourcePostprocessor(correlatorPostprocessorType);

            this.chromeDebugLogMeta = new LogSourceMetadata(
                chromeDebugLogFormat,
                stateInspectorPostprocessorsFactory.CreateChromeDebugPostprocessor(),
                timeSeriesPostprocessorsFactory.CreateChromeDebugPostprocessor(),
                timelinePostprocessorsFactory.CreateChromeDebugPostprocessor(),
                correlatorPostprocessorType
                );
            postprocessorsManager.RegisterLogType(this.chromeDebugLogMeta);

            this.webRtcInternalsDumpMeta = new LogSourceMetadata(
                webRtcInternalsDumpFormat,
                stateInspectorPostprocessorsFactory.CreateWebRtcInternalsDumpPostprocessor(),
                timeSeriesPostprocessorsFactory.CreateWebRtcInternalsDumpPostprocessor(),
                correlatorPostprocessorType
                );
            postprocessorsManager.RegisterLogType(this.webRtcInternalsDumpMeta);

            this.chromeDriverLogMeta = new LogSourceMetadata(
                chromeDriverLogFormat,
                timelinePostprocessorsFactory.CreateChromeDriverPostprocessor(),
                correlatorPostprocessorType
                );
            postprocessorsManager.RegisterLogType(this.chromeDriverLogMeta);

            this.symRtcLogMeta = new LogSourceMetadata(
                symRtcLogFormat,
                stateInspectorPostprocessorsFactory.CreateSymphontRtcPostprocessor()
                );
            postprocessorsManager.RegisterLogType(this.symRtcLogMeta);
        }
 public PresentationObjectsFactory(
     IPostprocessorsManager ppm,
     ILogSourcesManager lsm
     )
 {
     this.ppm = ppm;
     this.lsm = lsm;
 }
Ejemplo n.º 6
0
 public static async Task <bool> RunPostprocessors(this IPostprocessorsManager postprocessorsManager, LogSourcePostprocessorOutput[] logs, ClickFlags flags)
 {
     return(await postprocessorsManager.RunPostprocessor(
                logs
                .Select(output => new KeyValuePair <ILogSourcePostprocessor, ILogSource>(output.PostprocessorMetadata, output.LogSource))
                .ToArray(),
                forceSourcesSelection : (flags & ClickFlags.AnyModifier) != 0
                ));
 }
Ejemplo n.º 7
0
 public CorrelatorToastNotification(
     IPostprocessorsManager ppm,
     ILogSourcesManager lsm
     )
 {
     this.ppm     = ppm;
     ppm.Changed += (s, e) => Update();
     lsm.OnLogSourceTimeOffsetChanged += (s, e) => Update();
     Update();
 }
 public CorrelatorPostprocessorControlHandler(
     IPostprocessorsManager postprocessorsManager,
     ITempFilesManager tempFilesManager,
     IShellOpen shellOpen
     )
 {
     this.postprocessorsManager = postprocessorsManager;
     this.tempFilesManager      = tempFilesManager;
     this.postprocessorId       = PostprocessorIds.Correlator;
     this.shellOpen             = shellOpen;
 }
Ejemplo n.º 9
0
 public UnprocessedLogsToastNotification(
     IPostprocessorsManager ppm,
     ILogSourcesManager lsm,
     string postprocessorId
     )
 {
     this.ppm             = ppm;
     this.postprocessorId = postprocessorId;
     ppm.Changed         += (s, e) => Update();
     Update();
 }
Ejemplo n.º 10
0
        public static HashSet <string> GetCorrelatableLogsConnectionIds(this IPostprocessorsManager postprocessorsManager, IEnumerable <ILogSource> logs)
        {
            var correlatableLogSourceTypes =
                postprocessorsManager
                .KnownLogTypes.Where(t => t.SupportedPostprocessors.Any(pp => pp.TypeID == PostprocessorIds.Correlator))
                .ToLookup(t => t.LogProviderFactory);

            return
                (logs
                 .Where(i => !i.IsDisposed)
                 .Where(i => correlatableLogSourceTypes.Contains(i.Provider.Factory))
                 .Select(i => i.ConnectionId)
                 .ToHashSet());
        }
 public LogSourcePostprocessorControlHandler(
     IPostprocessorsManager postprocessorsManager,
     string postprocessorId,
     Func <IPostprocessorOutputForm> lazyOutputForm,
     LogJoint.UI.Presenters.IShellOpen shellOpen,
     ITempFilesManager tempFiles
     )
 {
     this.postprocessorsManager = postprocessorsManager;
     this.postprocessorId       = postprocessorId;
     this.lazyOutputForm        = lazyOutputForm;
     this.shellOpen             = shellOpen;
     this.tempFiles             = tempFiles;
 }
Ejemplo n.º 12
0
        public TimelineVisualizerModel(
            IPostprocessorsManager postprocessorsManager,
            ILogSourcesManager logSourcesManager,
            IUserNamesProvider shortNames,
            ILogSourceNamesProvider logSourceNamesProvider)
        {
            this.postprocessorsManager  = postprocessorsManager;
            this.shortNames             = shortNames;
            this.logSourceNamesProvider = logSourceNamesProvider;

            postprocessorsManager.Changed += (sender, args) => UpdateOutputs();
            logSourcesManager.OnLogSourceTimeOffsetChanged += (logSource, args) => UpdateAll();
            logSourcesManager.OnLogSourceVisiblityChanged  += (logSource, args) => UpdateOutputs();

            UpdateOutputs();
        }
Ejemplo n.º 13
0
        public TimelineVisualizerModel(
            IPostprocessorsManager postprocessorsManager,
            ILogSourcesManager logSourcesManager,
            IUserNamesProvider shortNames,
            ILogSourceNamesProvider logSourceNamesProvider)
        {
            this.postprocessorsManager  = postprocessorsManager;
            this.entitiesComparer       = TimelineEntitiesComparer.Instance;
            this.shortNames             = shortNames;
            this.logSourceNamesProvider = logSourceNamesProvider;

            postprocessorsManager.Changed += (sender, args) => UpdateOutputs(invalidateGroupContents: true);
            logSourcesManager.OnLogSourceTimeOffsetChanged += (logSource, args) => UpdateAll();
            logSourcesManager.OnLogSourceAnnotationChanged += (logSource, args) => UpdateOutputsSequenceDiagramNames(true);
            logSourcesManager.OnLogSourceVisiblityChanged  += (logSource, args) => UpdateOutputs(invalidateGroupContents: false);

            UpdateOutputs(invalidateGroupContents: false);
        }
Ejemplo n.º 14
0
        public SequenceDiagramVisualizerModel(
            IPostprocessorsManager postprocessorsManager,
            ILogSourcesManager logSourceManager,
            IUserNamesProvider shortNames,
            ILogSourceNamesProvider logSourceNamesProvider)
        {
            this.postprocessorsManager  = postprocessorsManager;
            this.shortNames             = shortNames;
            this.logSourceNamesProvider = logSourceNamesProvider;

            postprocessorsManager.Changed += (sender, args) => UpdateOutputs();
            logSourceManager.OnLogSourceTimeOffsetChanged += (s, e) => UpdateCachedContent();
            logSourceManager.OnLogSourceAnnotationChanged += (sender, args) => UpdateCachedContent();
            logSourceManager.OnLogSourceVisiblityChanged  += (sender, args) => UpdateOutputs();


            UpdateOutputs();
        }
Ejemplo n.º 15
0
        public static void Register(
            IPostprocessorsManager postprocessorsManager,
            IUserDefinedFormatsManager userDefinedFormatsManager
            )
        {
            var fac = userDefinedFormatsManager.Items.FirstOrDefault(f => f.FormatName == "LogJoint debug trace") as UDF;

            if (fac == null)
            {
                return;
            }
            var timeline = new LogSourcePostprocessorImpl(
                PostprocessorIds.Timeline, "Timeline",                 // todo: avoid copy/pasing of the strings
                (doc, logSource) => DeserializeOutput(doc, logSource),
                (Func <LogSourcePostprocessorInput, Task>)RunTimelinePostprocessor
                );

            postprocessorsManager.RegisterLogType(new LogSourceMetadata(fac, new []
            {
                timeline
            }));
        }
Ejemplo n.º 16
0
        public StateInspectorVisualizerModel(
            IPostprocessorsManager postprocessorsManager,
            ILogSourcesManager logSourcesManager,
            IInvokeSynchronization invokeSync,
            IUserNamesProvider shortNamesManager)
        {
            this.postprocessorsManager   = postprocessorsManager;
            this.outputsUpdateInvocation = new AsyncInvokeHelper(invokeSync, (Action)UpdateOutputs)
            {
                ForceAsyncInvocation = true
            };
            this.shortNamesManager = shortNamesManager;

            postprocessorsManager.Changed += (sender, args) =>
            {
                outputsUpdateInvocation.Invoke();
            };
            logSourcesManager.OnLogSourceVisiblityChanged += (sender, args) =>
            {
                outputsUpdateInvocation.Invoke();
            };

            UpdateOutputs();
        }
Ejemplo n.º 17
0
 public static HashSet <string> GetCorrelatableLogsConnectionIds(this IPostprocessorsManager postprocessorsManager)
 {
     return(GetCorrelatableLogsConnectionIds(postprocessorsManager, postprocessorsManager.KnownLogSources));
 }
 public AllPostprocessorsControlHandler(IPostprocessorsManager postprocessorsManager)
 {
     this.postprocessorsManager = postprocessorsManager;
 }
 public PostprocessorsFactory(Extensibility.IModel ljModel)
 {
     this.ljModel               = ljModel;
     this.modelThreadSync       = ljModel.ModelThreadSynchronization;
     this.postprocessorsManager = ljModel.Postprocessing.PostprocessorsManager;
 }
Ejemplo n.º 20
0
        public static CorrelatorStateSummary GetCorrelatorStateSummary(this IPostprocessorsManager postprocessorsManager)
        {
            var correlationOutputs =
                postprocessorsManager
                .LogSourcePostprocessorsOutputs
                .Where(output => output.PostprocessorMetadata.TypeID == PostprocessorIds.Correlator)
                .ToArray();

            if (correlationOutputs.Length < 2)
            {
                return(new CorrelatorStateSummary()
                {
                    Status = CorrelatorStateSummary.StatusCode.PostprocessingUnavailable
                });
            }
            var    correlatableLogsIds             = postprocessorsManager.GetCorrelatableLogsConnectionIds();
            int    numMissingOutput                = 0;
            int    numProgressing                  = 0;
            int    numFailed                       = 0;
            int    numCorrelationContextMismatches = 0;
            int    numCorrelationResultMismatches  = 0;
            double?progress = null;

            foreach (var i in correlationOutputs)
            {
                if (i.OutputStatus == LogSourcePostprocessorOutput.Status.InProgress)
                {
                    numProgressing++;
                    if (progress == null && i.Progress != null)
                    {
                        progress = i.Progress;
                    }
                }
                var typedOutput = i.OutputData as ICorrelatorPostprocessorOutput;
                if (typedOutput == null)
                {
                    ++numMissingOutput;
                }
                else
                {
                    if (!typedOutput.CorrelatedLogsConnectionIds.IsSupersetOf(correlatableLogsIds))
                    {
                        ++numCorrelationContextMismatches;
                    }
                    var actualOffsets = i.LogSource.IsDisposed ? TimeOffsets.Empty : i.LogSource.Provider.TimeOffsets;
                    if (typedOutput.Solution.BaseDelta != actualOffsets.BaseOffset)
                    {
                        ++numCorrelationResultMismatches;
                    }
                }
                if (i.OutputStatus == LogSourcePostprocessorOutput.Status.Failed)
                {
                    ++numFailed;
                }
            }
            if (numProgressing != 0)
            {
                return(new CorrelatorStateSummary()
                {
                    Status = CorrelatorStateSummary.StatusCode.ProcessingInProgress,
                    Progress = progress
                });
            }
            IPostprocessorRunSummary reportObject = correlationOutputs.First().LastRunSummary;
            string report = reportObject != null ? reportObject.Report : null;

            if (numMissingOutput != 0 || numCorrelationContextMismatches != 0 || numCorrelationResultMismatches != 0)
            {
                if (reportObject != null && reportObject.HasErrors)
                {
                    return(new CorrelatorStateSummary()
                    {
                        Status = CorrelatorStateSummary.StatusCode.ProcessingFailed,
                        Report = report
                    });
                }
                return(new CorrelatorStateSummary()
                {
                    Status = CorrelatorStateSummary.StatusCode.NeedsProcessing
                });
            }
            if (numFailed != 0)
            {
                return(new CorrelatorStateSummary()
                {
                    Status = CorrelatorStateSummary.StatusCode.ProcessingFailed,
                    Report = report
                });
            }
            return(new CorrelatorStateSummary()
            {
                Status = CorrelatorStateSummary.StatusCode.Processed,
                Report = report
            });
        }
Ejemplo n.º 21
0
 public static LogSourcePostprocessorOutput[] GetPostprocessorOutputsByPostprocessorId(this IPostprocessorsManager postprocessorsManager, string postprocessorId)
 {
     return(postprocessorsManager
            .LogSourcePostprocessorsOutputs
            .Where(output => output.PostprocessorMetadata.TypeID == postprocessorId)
            .ToArray());
 }
Ejemplo n.º 22
0
        public static IEnumerable <LogSourcePostprocessorOutput> GetAutoPostprocessingCapableOutputs(this IPostprocessorsManager postprocessorsManager)
        {
            Predicate <string> isRelevantPostprocessor = (id) =>
            {
                return
                    (id == PostprocessorIds.StateInspector ||
                     id == PostprocessorIds.Timeline ||
                     id == PostprocessorIds.SequenceDiagram ||
                     id == PostprocessorIds.TimeSeries ||
                     id == PostprocessorIds.Correlator);
            };

            Predicate <LogSourcePostprocessorOutput.Status> isStatusOk = (value) =>
            {
                return
                    (value == LogSourcePostprocessorOutput.Status.NeverRun ||
                     value == LogSourcePostprocessorOutput.Status.Failed ||
                     value == LogSourcePostprocessorOutput.Status.Outdated);
            };

            return
                (postprocessorsManager
                 .LogSourcePostprocessorsOutputs
                 .Where(output => isRelevantPostprocessor(output.PostprocessorMetadata.TypeID) && isStatusOk(output.OutputStatus)));
        }