public static void PublishNativeProxyStatistics(HttpContextBase httpContext) { RequestLogger logger = RequestLogger.GetLogger(httpContext); string value = httpContext.Response.Headers[NativeProxyLogHelper.NativeProxyStatusHeaders.BackEndHttpStatus]; if (!string.IsNullOrEmpty(value)) { logger.LogField(LogKey.BackendStatus, value); } string text = httpContext.Response.Headers[NativeProxyLogHelper.NativeProxyStatusHeaders.ProxyErrorHResult]; string arg = httpContext.Response.Headers[NativeProxyLogHelper.NativeProxyStatusHeaders.ProxyErrorLabel]; string arg2 = httpContext.Response.Headers[NativeProxyLogHelper.NativeProxyStatusHeaders.ProxyErrorMessage]; if (!string.IsNullOrEmpty(text)) { logger.LogField(LogKey.ErrorCode, text); string value2 = string.Format("[{0}] [{1}] {2}", text, arg, arg2); logger.AppendErrorInfo("ProxyError", value2); } HttpWorkerRequest httpWorkerRequest = (HttpWorkerRequest)((IServiceProvider)httpContext).GetService(typeof(HttpWorkerRequest)); bool hasWinHttpQuery = NativeProxyLogHelper.PublishTimestamps(httpWorkerRequest, logger); NativeProxyLogHelper.PublishLatencies(httpWorkerRequest, logger, hasWinHttpQuery); NativeProxyLogHelper.PublishCounters(httpWorkerRequest, logger); NativeProxyLogHelper.PublishStreamStats(httpWorkerRequest, logger); NativeProxyLogHelper.PublishGenericStats(httpWorkerRequest, logger, NativeProxyLogHelper.NativeProxyStatisticsVariables.RequestBufferSizeFootprints); NativeProxyLogHelper.PublishGenericStats(httpWorkerRequest, logger, NativeProxyLogHelper.NativeProxyStatisticsVariables.ResponseBufferSizeFootprints); if (NativeProxyLogHelper.LogBufferCopyStats.Value) { NativeProxyLogHelper.PublishGenericStats(httpWorkerRequest, logger, NativeProxyLogHelper.NativeProxyStatisticsVariables.BufferCopyStatsClientUpload); NativeProxyLogHelper.PublishGenericStats(httpWorkerRequest, logger, NativeProxyLogHelper.NativeProxyStatisticsVariables.BufferCopyStatsServerQuery); NativeProxyLogHelper.PublishGenericStats(httpWorkerRequest, logger, NativeProxyLogHelper.NativeProxyStatisticsVariables.BufferCopyStatsServerDownload); } }
private static void PublishCounters(HttpWorkerRequest httpWorkerRequest, RequestLogger logger) { string serverVariable = httpWorkerRequest.GetServerVariable(NativeProxyLogHelper.NativeProxyStatisticsVariables.Counters); if (!string.IsNullOrEmpty(serverVariable)) { logger.AppendGenericInfo(NativeProxyLogHelper.NativeProxyStatisticsVariables.Counters, serverVariable); } }
private static void PublishGenericStats(HttpWorkerRequest httpWorkerRequest, RequestLogger logger, string statsDataName) { string serverVariable = httpWorkerRequest.GetServerVariable(statsDataName); if (!string.IsNullOrEmpty(serverVariable)) { logger.AppendGenericInfo(statsDataName, serverVariable); } }
private static void PublishStreamStats(HttpWorkerRequest httpWorkerRequest, RequestLogger logger) { string serverVariable = httpWorkerRequest.GetServerVariable(NativeProxyLogHelper.NativeProxyStatisticsVariables.StreamStats); if (!string.IsNullOrEmpty(serverVariable)) { logger.AppendGenericInfo(NativeProxyLogHelper.NativeProxyStatisticsVariables.StreamStats, serverVariable); long[] array = NativeProxyLogHelper.ConvertStatisticsDataArray(serverVariable); logger.LogField(LogKey.RequestBytes, array[0]); logger.LogField(LogKey.ResponseBytes, array[2]); } }
internal void InitializeDiagnostics(HttpContextBase context) { context.InitializeLogging(); this.Logger = RequestLogger.GetLogger(context); this.Logger.LatencyTracker.LogElapsedTimeInDetailedLatencyInfo("Diagnosticmodule_InitializeDiagnostics_Start"); this.activityScope = (context.Items[typeof(ActivityScope)] as IActivityScope); if (this.activityScope == null) { this.activityScope = ActivityContext.GetCurrentActivityScope(); if (this.activityScope == null) { this.activityScope = ActivityContext.Start(null); } context.Items[typeof(ActivityScope)] = this.activityScope; } this.AddDiagnosticHeaders(context.Request); this.Logger.LatencyTracker.LogElapsedTimeInDetailedLatencyInfo("Diagnosticmodule_InitializeDiagnostics_End"); }
private static void PublishLatencies(HttpWorkerRequest httpWorkerRequest, RequestLogger logger, bool hasWinHttpQuery) { string serverVariable = httpWorkerRequest.GetServerVariable(NativeProxyLogHelper.NativeProxyStatisticsVariables.Latencies); if (!string.IsNullOrEmpty(serverVariable)) { logger.AppendGenericInfo(NativeProxyLogHelper.NativeProxyStatisticsVariables.Latencies, serverVariable); long[] array = NativeProxyLogHelper.ConvertStatisticsDataArray(serverVariable); logger.LogField(LogKey.ClientReqStreamLatency, array[0]); logger.LogField(LogKey.ClientRespStreamLatency, array[1]); logger.LogField(LogKey.BackendReqStreamLatency, array[2]); if (hasWinHttpQuery) { logger.LogField(LogKey.BackendRespStreamLatency, array[3]); return; } logger.LogField(LogKey.BackendRespStreamLatency, array[4]); } }
private static bool PublishTimestamps(HttpWorkerRequest httpWorkerRequest, RequestLogger logger) { bool result = false; string serverVariable = httpWorkerRequest.GetServerVariable(NativeProxyLogHelper.NativeProxyStatisticsVariables.Timestamps); if (!string.IsNullOrEmpty(serverVariable)) { logger.AppendGenericInfo(NativeProxyLogHelper.NativeProxyStatisticsVariables.Timestamps, serverVariable); long[] array = NativeProxyLogHelper.ConvertStatisticsDataArray(serverVariable); logger.LogField(LogKey.ModuleToHandlerSwitchingLatency, array[1] - array[0]); long num = array[14] - array[3]; logger.LogField(LogKey.BackendProcessingLatency, num); long num2 = num; if (array[22] >= 0L) { num2 = array[22] - array[3]; } logger.LogField(LogKey.ProxyTime, num2); result = (array[15] >= 0L); } return(result); }