Exemplo n.º 1
0
        internal override void ProcessLogEntry(MailboxLogEntry entry)
        {
            ReportRowBase row = new DummyReportRow();

            if (entry.Command != "Ping")
            {
                return;
            }

            row[PingAnalysisReport.PingHeartBeatInterval] = ParseHelper.ParseStringBetweenTokens(entry.RequestBody, "<HeartbeatInterval>", "</HeartbeatInterval>");

            if (entry.RequestBody.Trim().Length > 0 && entry.RequestBody.Contains("xml"))
            {
                XElement   root = XElement.Parse(entry.RequestBody.Trim());
                XNamespace ns   = root.Attribute("xmlns").Value;

                IEnumerable <XElement> folders =
                    from f in root.Descendants(ns + "Folder")
                    select(XElement) f;

                string foldersText = string.Empty;
                foreach (XElement folder in folders)
                {
                    if (foldersText.Length > 0)
                    {
                        foldersText = foldersText + ", ";
                    }

                    foldersText = foldersText + (string)folder.Element(ns + "Id") + " (" + (string)folder.Element(ns + "Class") + ")";
                }

                row[PingAnalysisReport.PingRequestFoldersText] = foldersText;
            }

            if (entry.ResponseBody.Trim().Length > 0 && entry.ResponseBody.Contains("xml"))
            {
                XElement   root = XElement.Parse(entry.ResponseBody.Trim());
                XNamespace ns2  = root.Attribute("xmlns").Value;

                IEnumerable <XElement> folders2 =
                    from f in root.Descendants(ns2 + "Folder")
                    select(XElement) f;

                string foldersText2 = string.Empty;
                foreach (XElement folder2 in folders2)
                {
                    if (foldersText2.Length > 0)
                    {
                        foldersText2 = foldersText2 + ", ";
                    }

                    foldersText2 = foldersText2 + folder2.Value;
                }

                row[PingAnalysisReport.PingResponseFoldersText] = foldersText2;
            }

            this.ReportRows.Add(row);
        }
Exemplo n.º 2
0
        internal override void ProcessLogEntry(MailboxLogEntry entry)
        {
            ReportRowBase row = new DummyReportRow();

            // Find UID in request or response

            //IEnumerable<XElement> requestGoids = ParseHelper.GetXElements(entry.RequestBody, "GlobalObjId");

            TrackGoids(ParseHelper.GetXElements(entry.ResponseBody, "GlobalObjId"), entry, row);

            //IEnumerable<XElement> requestUids = ParseHelper.GetXElements(entry.RequestBody, "UID");

            TrackUids(ParseHelper.GetXElements(entry.ResponseBody, "UID"), entry, row);

            this.ReportRows.Add(row);
        }
        internal override void ProcessLogEntry(MailboxLogEntry entry)
        {
            ReportRowBase row = new DummyReportRow();

            if (entry.Command != "Sync")
            {
                return;
            }

            // Sync request data
            SyncRequest sync = entry.RequestObject as SyncRequest;

            row[SyncAnalysisReport.SyncHeartbeatInterval] = sync.HeartbeatInterval.ToString();

            foreach (Collection c in sync.Collections)
            {
                AppendValueToColumn(row, SyncAnalysisReport.SyncRequestCollectionIds, c.CollectionId);
                AppendValueToColumn(row, SyncAnalysisReport.SyncWindowSizes, c.WindowSize.ToString());
                AppendValueToColumn(row, SyncAnalysisReport.SyncRequestKeys, c.SyncKey);

                // Track duplicate Sync requests in previous logs with matching CollectionId and SyncKey
                string duplicateTrackKey = c.CollectionId + c.SyncKey;
                if (!this.CurrentCollectionIdSyncKey.ContainsKey(duplicateTrackKey))
                {
                    this.CurrentCollectionIdSyncKey.Add(duplicateTrackKey, -1);
                }
                this.CurrentCollectionIdSyncKey[duplicateTrackKey]++;

                // If one or more duplicate is found the report it
                if (this.CurrentCollectionIdSyncKey[duplicateTrackKey] > 0)
                {
                    AppendValueToColumn(row, SyncAnalysisReport.SyncDuplicateCounts, this.CurrentCollectionIdSyncKey[duplicateTrackKey].ToString());
                }

                //if (duplicates.Count<ReportRow>() > 0)
                //{
                //    DateTime thisRequestTime = DateTime.Parse(row[FlatSyncAnalysisReport.RequestTime]);
                //    DateTime lastDupeRequestTime = DateTime.Parse(duplicates.First<ReportRow>()[FlatSyncAnalysisReport.RequestTime]);

                //    TimeSpan interval = new TimeSpan(thisRequestTime.Ticks - lastDupeRequestTime.Ticks);

                //    AppendValueToColumn(row, SyncAnalyzer.SyncLastDuplicateIntervals, interval.Seconds.ToString());
                //}

                // Process Commands issued in the Sync request
                if (c.Commands != null && c.Commands.Fetch != null && c.Commands.Fetch.ServerIds != null)
                {
                    // Capture just a count of the ServerIds in the Fetch
                    AppendValueToColumn(row, SyncAnalysisReport.SyncRequestFetchCountPerCollection, c.Commands.Fetch.ServerIds.Length.ToString());

                    // Capture the actual ServerIds for the Fetch
                    foreach (ServerId serverId in c.Commands.Fetch.ServerIds)
                    {
                        AppendValueToColumn(row, SyncAnalysisReport.SyncRequestFetchServerIdsPerCollection, serverId.ToString());
                    }
                }
            }

            // Sync response data
            IEnumerable <XElement> responseKeys = ParseHelper.GetXElements(entry.ResponseBody, "SyncKey");

            foreach (XElement responseKey in responseKeys)
            {
                AppendValueToColumn(row, SyncAnalysisReport.SyncResponseKeys, responseKey.Value);
            }

            //IEnumerable<XElement> collections = ParseHelper.GetXElements(entry.ResponseBody, "Collection");
            //foreach (XElement collection in collections)
            //{
            //    IEnumerable<XElement> adds = ParseHelper.GetXElements(entry.ResponseBody, "Add");
            //    AppendValueToColumn(row, SyncAnalyzer.SyncResponseAdds, adds.ToString());
            //}

            this.ReportRows.Add(row);
        }