Exemplo n.º 1
0
        public string GetSucceededQueryLogData()
        {
            StringBuilder stringBuilder = new StringBuilder(1024);

            foreach (KeyValuePair <string, List <FreeBusyQuery> > keyValuePair in this.succeededQueries)
            {
                string key = keyValuePair.Key;
                List <FreeBusyQuery> value = keyValuePair.Value;
                stringBuilder.AppendFormat("{0}-{1}|", "Target", key);
                foreach (KeyValuePair <string, string> keyValuePair2 in value[0].LogData)
                {
                    stringBuilder.AppendFormat("{0}-{1}|", keyValuePair2.Key, keyValuePair2.Value);
                }
                string text = (value[0].Type != null) ? value[0].Type.Value.ToString() : "NULL";
                stringBuilder.AppendFormat("{0}-{1}|{2}-{3}|", new object[]
                {
                    "QT",
                    text,
                    "Cnt",
                    value.Count
                });
                foreach (FreeBusyQuery query in value)
                {
                    string intraForestLatency = QueryLogData.GetIntraForestLatency(query);
                    if (!string.IsNullOrEmpty(intraForestLatency))
                    {
                        stringBuilder.AppendFormat("[{0}]", intraForestLatency);
                    }
                }
                stringBuilder.Append(";");
            }
            return(stringBuilder.ToString());
        }
Exemplo n.º 2
0
        public void CalculateQueryStatistics(FreeBusyQuery[] queries)
        {
            if (queries == null)
            {
                return;
            }
            QueryLogData queryLogData = new QueryLogData();

            for (int i = 0; i < queries.Length; i++)
            {
                FreeBusyQueryResult result = queries[i].Result;
                if (result != null)
                {
                    if (result.ExceptionInfo != null)
                    {
                        this.UpdateExceptionStatictics(result.ExceptionInfo);
                        queryLogData.Add(queries[i], true);
                    }
                    else
                    {
                        queryLogData.Add(queries[i], false);
                    }
                }
                else
                {
                    queryLogData.Add(queries[i], false);
                }
            }
            this.logData.Append(queryLogData.GetSucceededQueryLogData());
            this.errorData = queryLogData.GetFailedQueryLogData();
        }
Exemplo n.º 3
0
        public List <string> GetFailedQueryLogData()
        {
            List <string> list = new List <string>(this.failedQueries.Count);

            foreach (KeyValuePair <string, List <FreeBusyQuery> > keyValuePair in this.failedQueries)
            {
                string key = keyValuePair.Key;
                List <FreeBusyQuery> value         = keyValuePair.Value;
                StringBuilder        stringBuilder = new StringBuilder(1024);
                stringBuilder.AppendFormat("{0}-{1}|", "Target", key);
                foreach (KeyValuePair <string, string> keyValuePair2 in value[0].LogData)
                {
                    stringBuilder.AppendFormat("{0}-{1}|", keyValuePair2.Key, keyValuePair2.Value);
                }
                if (value[0].Type != null)
                {
                    stringBuilder.AppendFormat("{0}-{1}|{2}-{3}|", new object[]
                    {
                        "QT",
                        value[0].Type.Value,
                        "Cnt",
                        value.Count
                    });
                }
                else
                {
                    stringBuilder.AppendFormat("{0}-{1}|", "Cnt", value.Count);
                }
                HashSet <Type> hashSet = new HashSet <Type>();
                foreach (FreeBusyQuery freeBusyQuery in value)
                {
                    Exception    exceptionInfo = freeBusyQuery.Result.ExceptionInfo;
                    Exception    ex            = exceptionInfo;
                    WebException ex2           = exceptionInfo as WebException;
                    while (ex.InnerException != null)
                    {
                        ex = ex.InnerException;
                        if (ex2 == null)
                        {
                            ex2 = (ex as WebException);
                        }
                    }
                    if (!hashSet.Contains(ex.GetType()))
                    {
                        stringBuilder.Append("[");
                        AvailabilityException ex3 = exceptionInfo as AvailabilityException;
                        if (ex3 != null)
                        {
                            stringBuilder.AppendFormat("{0}-{1}|", "EXPS", ex3.ServerName);
                            if (!string.IsNullOrEmpty(ex3.LocationIdentifier))
                            {
                                stringBuilder.AppendFormat("{0}-{1}|", "LID", ex3.LocationIdentifier);
                            }
                        }
                        if (freeBusyQuery.Email != null)
                        {
                            stringBuilder.AppendFormat("{0}-{1}|", "AT", freeBusyQuery.Email.Address);
                        }
                        stringBuilder.AppendFormat("{0}-{1}|", "EXPM", exceptionInfo.GetType().Name + ":" + exceptionInfo.Message);
                        if (exceptionInfo.GetType() != ex.GetType())
                        {
                            stringBuilder.AppendFormat("{0}-{1}|", "IEXPM", ex.GetType().Name + ":" + ex.Message);
                        }
                        hashSet.Add(ex.GetType());
                        if (ex2 != null)
                        {
                            HttpWebResponse httpWebResponse = ex2.Response as HttpWebResponse;
                            if (httpWebResponse != null)
                            {
                                string text = httpWebResponse.Headers.Get(MSDiagnosticsHeader.HeaderName);
                                if (text != null)
                                {
                                    stringBuilder.AppendFormat("{0}-{1}|", "DI", text);
                                }
                                string text2 = httpWebResponse.Headers.Get("request-id");
                                if (text2 != null)
                                {
                                    string text3 = httpWebResponse.Headers.Get(WellKnownHeader.XFEServer);
                                    string text4 = httpWebResponse.Headers.Get(WellKnownHeader.XCalculatedBETarget);
                                    stringBuilder.AppendFormat("{0}-{1}|{2}-{3}|{4}-{5}", new object[]
                                    {
                                        "RID",
                                        text2,
                                        "TFE",
                                        text3,
                                        "TBE",
                                        text4
                                    });
                                }
                            }
                        }
                        stringBuilder.Append(QueryLogData.GetIntraForestLatency(freeBusyQuery));
                        stringBuilder.Append(']');
                    }
                }
                list.Add(stringBuilder.ToString());
            }
            return(list);
        }