コード例 #1
0
 internal void LogLatencies(RequestDetailsLogger logger)
 {
     logger.Set(RoutingUpdateModuleMetadata.AccountForestLatencyBreakup, RoutingUpdateDiagnostics.GetBreakupOfLatencies(this.accountForestLatencies));
     logger.Set(RoutingUpdateModuleMetadata.TotalAccountForestLatency, this.accountForestLatencies.Sum());
     logger.Set(RoutingUpdateModuleMetadata.GlsLatencyBreakup, RoutingUpdateDiagnostics.GetBreakupOfLatencies(this.globalLocatorLatencies));
     logger.Set(RoutingUpdateModuleMetadata.TotalGlsLatency, this.globalLocatorLatencies.Sum());
     logger.Set(RoutingUpdateModuleMetadata.ResourceForestLatencyBreakup, RoutingUpdateDiagnostics.GetBreakupOfLatencies(this.resourceForestLatencies));
     logger.Set(RoutingUpdateModuleMetadata.TotalResourceForestLatency, this.resourceForestLatencies.Sum());
     logger.Set(RoutingUpdateModuleMetadata.ActiveManagerLatencyBreakup, RoutingUpdateDiagnostics.GetBreakupOfLatencies(this.activeManagerLatencies));
     logger.Set(RoutingUpdateModuleMetadata.TotalActiveManagerLatency, this.activeManagerLatencies.Sum());
     logger.Set(RoutingUpdateModuleMetadata.ServerLocatorLatency, this.serverLocatorLatencies.Sum());
 }
コード例 #2
0
 public void OnBeginRequest(HttpContextBase context)
 {
     ExWatson.SendReportOnUnhandledException(delegate()
     {
         RequestDetailsLogger requestDetailsLogger         = null;
         RoutingUpdateDiagnostics routingUpdateDiagnostics = this.diagnostics as RoutingUpdateDiagnostics;
         if (routingUpdateDiagnostics != null)
         {
             HttpContext context2 = context.ApplicationInstance.Context;
             requestDetailsLogger = RequestDetailsLoggerBase <RequestDetailsLogger> .InitializeRequestLogger();
             RequestDetailsLoggerBase <RequestDetailsLogger> .SetCurrent(context2, requestDetailsLogger);
             requestDetailsLogger.Set(RoutingUpdateModuleMetadata.Protocol, RequestDetailsLogger.ProtocolType.Value);
             routingUpdateDiagnostics.Clear();
         }
         NameValueCollection headers = context.Request.Headers;
         List <string> list          = new List <string>();
         list.AddIfNotNull(headers.Get("X-RoutingEntry"));
         if (RoutingUpdateModule.RUMLegacyRoutingEntryEnabled.Value)
         {
             list.AddIfNotNull(headers.Get("X-LegacyRoutingEntry"));
         }
         if (list.Count > 0)
         {
             try
             {
                 foreach (string text in list)
                 {
                     string[] source = text.Split(new char[]
                     {
                         ','
                     });
                     IEnumerable <IRoutingEntry> routingEntries = from entry in source
                                                                  where RoutingEntryHeaderSerializer.IsValidHeaderString(entry)
                                                                  select RoutingEntryHeaderSerializer.Deserialize(entry);
                     foreach (string value in this.GetRoutingUpdates(routingEntries))
                     {
                         context.Response.Headers.Add("X-RoutingEntryUpdate", value);
                     }
                 }
             }
             catch (Exception ex)
             {
                 requestDetailsLogger.AppendGenericError("Exception", ex.ToString());
                 throw;
             }
         }
         if (routingUpdateDiagnostics != null && !requestDetailsLogger.IsDisposed)
         {
             if (routingUpdateDiagnostics.GetTotalLatency() > 0L)
             {
                 routingUpdateDiagnostics.LogLatencies(requestDetailsLogger);
                 requestDetailsLogger.Commit();
             }
             else
             {
                 requestDetailsLogger.SkipLogging = true;
             }
             requestDetailsLogger.Dispose();
         }
     });
 }