Пример #1
0
        // Token: 0x06002544 RID: 9540 RVA: 0x00086D20 File Offset: 0x00084F20
        protected override ICollection <KeyValuePair <string, object> > GetComponentSpecificData(IActivityScope activityScope, string eventId)
        {
            Dictionary <string, object> dictionary = new Dictionary <string, object>(20);
            IEnumerable <KeyValuePair <string, object> > formattableMetadata = activityScope.GetFormattableMetadata(OwsLogRegistry.GetRegisteredValues(eventId));

            foreach (KeyValuePair <string, object> keyValuePair in formattableMetadata)
            {
                dictionary.Add(keyValuePair.Key, keyValuePair.Value);
            }
            ExtensibleLogger.CopyPIIProperty(activityScope, dictionary, OwaServerLogger.LoggerData.PrimarySmtpAddress, "PSA");
            ExtensibleLogger.CopyPIIProperty(activityScope, dictionary, OwaServerLogger.LoggerData.User, "user");
            ExtensibleLogger.CopyProperties(activityScope, dictionary, OwaServerLogger.EnumToShortKeyMapping);
            if (Globals.LogErrorDetails)
            {
                ExtensibleLogger.CopyProperty(activityScope, dictionary, ServiceCommonMetadata.GenericErrors, "ErrInfo");
                string property = activityScope.GetProperty(ServiceCommonMetadata.ErrorCode);
                if ((!string.IsNullOrEmpty(activityScope.GetProperty(ServiceCommonMetadata.GenericErrors)) || (!string.IsNullOrEmpty(property) && property != "Success" && property != "0")) && HttpContext.Current != null)
                {
                    string key = OwaServerLogger.EnumToShortKeyMapping[OwaServerLogger.LoggerData.UserAgent];
                    if (!dictionary.ContainsKey(key))
                    {
                        dictionary.Add(key, HttpContext.Current.Request.UserAgent);
                    }
                }
            }
            return(dictionary);
        }
Пример #2
0
        private static void FinalizeRequestLatencies(HttpContext httpContext, RequestDetailsLogger requestDetailsLogger, IActivityScope activityScope, LatencyTracker tracker, int traceContext)
        {
            if (tracker == null)
            {
                return;
            }
            if (requestDetailsLogger == null)
            {
                throw new ArgumentNullException("requestDetailsLogger");
            }
            if (activityScope == null)
            {
                throw new ArgumentNullException("activityScope");
            }
            if (httpContext == null)
            {
                throw new ArgumentNullException("httpContext");
            }
            long num = tracker.GetCurrentLatency(LatencyTrackerKey.ProxyModuleLatency);

            if (num >= 0L)
            {
                long num2 = 0L;
                long.TryParse(activityScope.GetProperty(ServiceLatencyMetadata.HttpPipelineLatency), out num2);
                long num3 = 0L;
                bool flag = requestDetailsLogger.TryGetLatency(HttpProxyMetadata.BackendProcessingLatency, out num3);
                long num4 = requestDetailsLogger.GetLatency(HttpProxyMetadata.ClientRequestStreamingLatency, 0L) + requestDetailsLogger.GetLatency(HttpProxyMetadata.BackendRequestStreamingLatency, 0L) + num3 + requestDetailsLogger.GetLatency(HttpProxyMetadata.BackendResponseStreamingLatency, 0L) + requestDetailsLogger.GetLatency(HttpProxyMetadata.ClientResponseStreamingLatency, 0L);
                long num5 = num - num4;
                PerfCounters.UpdateMovingAveragePerformanceCounter(PerfCounters.HttpProxyCountersInstance.MovingAverageCasLatency, num5);
                RequestDetailsLoggerBase <RequestDetailsLogger> .SafeSetLogger(requestDetailsLogger, HttpProxyMetadata.HttpProxyOverhead, num5);

                long num6 = num5 - num2;
                if (flag)
                {
                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeSetLogger(requestDetailsLogger, HttpProxyMetadata.RoutingLatency, Math.Max(num6, 0L));

                    string property = activityScope.GetProperty(HttpProxyMetadata.TargetServer);
                    if (PerfCounters.RoutingLatenciesEnabled && !string.IsNullOrEmpty(property))
                    {
                        string empty = string.Empty;
                        Utilities.TryGetSiteNameFromServerFqdn(property, out empty);
                        PercentilePerfCounters.UpdateRoutingLatencyPerfCounter(empty, (double)num6);
                        PerfCounters.GetHttpProxyPerSiteCountersInstance(empty).TotalProxyWithLatencyRequests.Increment();
                    }
                }
                long val = num6 - requestDetailsLogger.GetLatency(HttpProxyMetadata.BackendRequestInitLatency, 0L) - requestDetailsLogger.GetLatency(HttpProxyMetadata.BackendResponseInitLatency, 0L);
                RequestDetailsLoggerBase <RequestDetailsLogger> .SafeSetLogger(requestDetailsLogger, HttpProxyMetadata.CoreLatency, Math.Max(val, 0L));

                long currentLatency = tracker.GetCurrentLatency(LatencyTrackerKey.ProxyModuleLatency);
                long num7           = currentLatency - num;
                num = currentLatency;
                if (num7 > 5L)
                {
                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(requestDetailsLogger, "TotalRequestTimeDelta", num7);
                }
            }
            RequestDetailsLoggerBase <RequestDetailsLogger> .SafeSetLogger(requestDetailsLogger, HttpProxyMetadata.TotalRequestTime, num);
        }
Пример #3
0
        // Token: 0x06002562 RID: 9570 RVA: 0x000877D8 File Offset: 0x000859D8
        private static bool IsInterestingFailure(IActivityScope activityScope)
        {
            bool   flag      = OwaServerTraceLogger.IsOverPerfThreshold(activityScope.TotalMilliseconds);
            string property  = activityScope.GetProperty(ServiceCommonMetadata.ErrorCode);
            string property2 = activityScope.GetProperty(ServiceCommonMetadata.GenericErrors);

            if (string.IsNullOrEmpty(property) && string.IsNullOrEmpty(property2))
            {
                return(flag);
            }
            return(property == null || !property.Contains("NotFound") || flag);
        }
Пример #4
0
        internal static string GetDiagnosticsInfo(HttpContext context)
        {
            RequestDetailsLogger current = RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(context);

            Guid           guid          = Guid.Empty;
            IActivityScope activityScope = null;

            if (current != null)
            {
                guid          = current.ActivityId;
                activityScope = current.ActivityScope;
            }
            string text = string.Format("[ClientAccessServer={0},BackEndServer={1},RequestId={2},TimeStamp={3}] ", new object[]
            {
                Environment.MachineName,
                (activityScope == null) ? "UnKown" : activityScope.GetProperty(HttpProxyMetadata.TargetServer),
                guid,
                DateTime.UtcNow
            });
            string text2 = string.Empty;

            if (context != null)
            {
                text2 = WinRMInfo.GetFailureCategoryInfo(context);
            }
            if (!string.IsNullOrEmpty(text2))
            {
                text += string.Format("[FailureCategory={0}] ", text2);
            }
            ExTraceGlobals.VerboseTracer.TraceDebug <string>(0L, "[WinRMHelper::GetDiagnosticsInfo] diagnosticsInfo = {0}.", text);
            return(text);
        }
Пример #5
0
        // Token: 0x06002563 RID: 9571 RVA: 0x00087834 File Offset: 0x00085A34
        private static void InternalSaveTraces(IActivityScope activityScope, TroubleshootingContext troubleshootingContext)
        {
            IEnumerable <TraceEntry> traces = troubleshootingContext.GetTraces();
            string eventId = activityScope.GetProperty(ExtensibleLoggerMetadata.EventId) + "_Trace";

            foreach (TraceEntry entry in traces)
            {
                OwaServerTraceLogger.TraceLogEvent logEvent = new OwaServerTraceLogger.TraceLogEvent(activityScope, entry, eventId);
                OwaServerTraceLogger.instance.LogEvent(logEvent);
            }
        }
Пример #6
0
        private static void CopyProperty(IActivityScope source, Dictionary <string, object> target, Enum sourceKey, string targetKey, bool isPII)
        {
            string property = source.GetProperty(sourceKey);

            if (property == null)
            {
                return;
            }
            if (target.ContainsKey(targetKey))
            {
                throw new ArgumentException(string.Format("targetKey '{0}' is already being used by another property: {1}", targetKey, sourceKey));
            }
            target.Add(targetKey, isPII ? ExtensibleLogger.FormatPIIValue(property) : property);
        }
Пример #7
0
        public void LogActivityEvent(IActivityScope activityScope, ActivityEventType eventType)
        {
            if (activityScope == null)
            {
                throw new ArgumentNullException("activityScope");
            }
            if (!this.configuration.IsLoggingEnabled || !this.IsInterestingEvent(activityScope, eventType))
            {
                return;
            }
            ILogEvent logEvent = activityScope.UserState as ILogEvent;
            ICollection <KeyValuePair <string, object> > collection;
            string text;

            if (logEvent != null)
            {
                collection = this.GetEventData(logEvent);
                text       = logEvent.EventId;
            }
            else
            {
                collection = new List <KeyValuePair <string, object> >(0);
                if (activityScope.ActivityType == ActivityType.Global)
                {
                    text = "GlobalActivity";
                }
                else
                {
                    text = activityScope.GetProperty(ExtensibleLoggerMetadata.EventId);
                }
            }
            if (string.IsNullOrEmpty(text))
            {
                text = "<null>";
            }
            ICollection <KeyValuePair <string, object> > componentSpecificData = this.GetComponentSpecificData(activityScope, text);
            List <KeyValuePair <string, object> >        list = this.FormatWlmActivity(activityScope);
            int capacity = collection.Count + componentSpecificData.Count + list.Count + 2;
            List <KeyValuePair <string, object> > list2 = new List <KeyValuePair <string, object> >(capacity);

            list2.AddRange(collection);
            list2.AddRange(componentSpecificData);
            list2.Add(new KeyValuePair <string, object>("Bld", this.buildNumber));
            list2.Add(new KeyValuePair <string, object>("ActID", activityScope.ActivityId));
            list2.AddRange(list);
            this.LogRow(text, list2);
        }
Пример #8
0
        // Token: 0x0600046E RID: 1134 RVA: 0x00018BF0 File Offset: 0x00016DF0
        internal static string GetDiagnosticsInfo(HttpContext context)
        {
            RequestDetailsLogger current = RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(context);

            Guid           guid          = Guid.Empty;
            IActivityScope activityScope = null;

            if (current != null)
            {
                guid          = current.ActivityId;
                activityScope = current.ActivityScope;
            }
            string text = string.Format("[ClientAccessServer={0},BackEndServer={1},RequestId={2},TimeStamp={3}] ", new object[]
            {
                Environment.MachineName,
                (activityScope == null) ? "UnKnown" : activityScope.GetProperty(13),
                guid,
                DateTime.UtcNow
            });
            string text2 = string.Empty;

            if (context != null)
            {
                text2 = WinRMInfo.GetFailureCategoryInfo(context);
            }
            if (!string.IsNullOrEmpty(text2))
            {
                text += string.Format("[FailureCategory={0}] ", text2);
            }
            string text3 = context.Response.Headers["X-BasicAuthToOAuthConversionDiagnostics"];

            if (!string.IsNullOrWhiteSpace(text3))
            {
                text += string.Format("BasicAuthToOAuthConversionDiagnostics={0}", text3);
            }
            if (ExTraceGlobals.VerboseTracer.IsTraceEnabled(1))
            {
                ExTraceGlobals.VerboseTracer.TraceDebug <string>(0L, "[WinRMHelper::GetDiagnosticsInfo] diagnosticsInfo = {0}.", text);
            }
            return(text);
        }
        private static void PublishGeneric(HttpContextBase context)
        {
            IActivityScope currentActivityScope = ServiceCommonMetadataPublisher.GetCurrentActivityScope(context);

            if (currentActivityScope == null)
            {
                return;
            }
            ServiceCommonMetadataPublisher.PublishServerInfo(currentActivityScope);
            if (context == null)
            {
                return;
            }
            HttpRequestBase  request  = context.Request;
            HttpResponseBase response = context.Response;
            string           value    = request.GetRequestHeader("X-Forwarded-For");

            if (string.IsNullOrEmpty(value))
            {
                value = request.UserHostAddress;
            }
            currentActivityScope.SetProperty(ServiceCommonMetadata.ClientIpAddress, value);
            currentActivityScope.SetProperty(ActivityStandardMetadata.ClientInfo, request.UserAgent);
            currentActivityScope.SetProperty(ServiceCommonMetadata.RequestSize, request.ContentLength.ToString());
            if (currentActivityScope.GetProperty(ServiceCommonMetadata.HttpStatus) == null)
            {
                currentActivityScope.SetProperty(ServiceCommonMetadata.HttpStatus, response.StatusCode.ToString());
            }
            if (request.Cookies.Count > 0)
            {
                for (int i = 0; i < request.Cookies.Count; i++)
                {
                    if (string.Equals(request.Cookies[i].Name, "exchangecookie", StringComparison.OrdinalIgnoreCase))
                    {
                        currentActivityScope.SetProperty(ServiceCommonMetadata.Cookie, request.Cookies[i].Value);
                        return;
                    }
                }
            }
        }
Пример #10
0
        // Token: 0x060005F2 RID: 1522 RVA: 0x00021190 File Offset: 0x0001F390
        private static void FinalizeRequestLatencies(HttpContext httpContext, RequestDetailsLogger requestDetailsLogger, IActivityScope activityScope, LatencyTracker tracker, int traceContext)
        {
            if (tracker == null)
            {
                return;
            }
            if (requestDetailsLogger == null)
            {
                throw new ArgumentNullException("requestDetailsLogger");
            }
            if (activityScope == null)
            {
                throw new ArgumentNullException("activityScope");
            }
            if (httpContext == null)
            {
                throw new ArgumentNullException("httpContext");
            }
            HttpContextBase wrapper = SharedHttpContextWrapper.GetWrapper(httpContext);
            long            num     = tracker.GetCurrentLatency(LatencyTrackerKey.ProxyModuleLatency);

            if (num >= 0L)
            {
                long num2 = 0L;
                long.TryParse(activityScope.GetProperty(6), out num2);
                long num3 = 0L;
                bool flag = requestDetailsLogger.TryGetLatency(37, ref num3);
                long num4 = requestDetailsLogger.GetLatency(34, 0L) + requestDetailsLogger.GetLatency(36, 0L) + num3 + requestDetailsLogger.GetLatency(39, 0L) + requestDetailsLogger.GetLatency(40, 0L);
                long num5 = num - num4;
                if (!NativeProxyHelper.WasProxiedByNativeProxyHandler(wrapper))
                {
                    PerfCounters.UpdateMovingAveragePerformanceCounter(PerfCounters.HttpProxyCountersInstance.MovingAverageCasLatency, num5);
                }
                RequestDetailsLoggerBase <RequestDetailsLogger> .SafeSetLogger(requestDetailsLogger, 43, num5);

                long num6 = num5 - num2;
                if (flag)
                {
                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeSetLogger(requestDetailsLogger, 42, Math.Max(num6, 0L));

                    string property = activityScope.GetProperty(13);
                    if (PerfCounters.RoutingLatenciesEnabled && !string.IsNullOrEmpty(property))
                    {
                        string empty = string.Empty;
                        Utilities.TryExtractForestFqdnFromServerFqdn(property, ref empty);
                        PercentilePerfCounters.UpdateRoutingLatencyPerfCounter(empty, (double)num6);
                        PerfCounters.GetHttpProxyPerForestCountersInstance(empty).TotalProxyWithLatencyRequests.Increment();
                    }
                }
                long val = num6 - requestDetailsLogger.GetLatency(35, 0L) - requestDetailsLogger.GetLatency(38, 0L);
                RequestDetailsLoggerBase <RequestDetailsLogger> .SafeSetLogger(requestDetailsLogger, 41, Math.Max(val, 0L));

                long currentLatency = tracker.GetCurrentLatency(LatencyTrackerKey.ProxyModuleLatency);
                long num7           = currentLatency - num;
                num = currentLatency;
                if (num7 > 5L)
                {
                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(requestDetailsLogger, "TotalRequestTimeDelta", num7);
                }
            }
            RequestDetailsLoggerBase <RequestDetailsLogger> .SafeSetLogger(requestDetailsLogger, 16, num);
        }
Пример #11
0
 // Token: 0x06002546 RID: 9542 RVA: 0x00086EAB File Offset: 0x000850AB
 protected override bool IsInterestingEvent(IActivityScope activityScope, ActivityEventType eventType)
 {
     return(base.IsInterestingEvent(activityScope, eventType) && (activityScope.GetProperty(ExtensibleLoggerMetadata.EventId) != null || activityScope.Statistics.Any <KeyValuePair <OperationKey, OperationStatistics> >()));
 }