public void Convert(TabSection section, OAEventLog eventLog) { section.AddRow() .Column(eventLog.DisplayName) .Column(this.GetMetricsValue(eventLog)) .Column(BaseMetricsConverter.GetDurationMetricValue(eventLog)) .Column(eventLog.Timestamp.ToString("HH:mm:ss.fff")); }
protected override object GetMetricsValue(OAEventLog eventLog) { string query = string.IsNullOrEmpty(eventLog.Query) ? eventLog.Information : eventLog.Query; return(string.Format("{0}\n{1}\nConnection #{2}\n{3}\n", query, eventLog.Params, eventLog.ConnectionId, eventLog.StackTrace)); }
public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data) { if (data == null || HttpContext.Current == null) { return; } OAEventLog eventLog = Mapper.DynamicMap <OAEventLog>(data); if (string.IsNullOrEmpty(eventLog.Name) || OAGlimpseTraceListener.metrics.ContainsKey(eventLog.Name) == false) { return; } if (string.Equals(eventLog.Name, Constants.CommandQuery) || string.Equals(eventLog.Name, Constants.CommandUpdate)) { eventLog.Params = OAGlimpseTraceListener.GetParameterInformation(data); eventLog.Offset = this.TimerStrategy.Start(); } else if (string.Equals(eventLog.Name, Constants.CloseReader)) { OAEventLog command = OAGlimpseTraceListener.GetList().FirstOrDefault(x => x.StatementId == eventLog.StatementId); if (command != null) { command.Duration = TimeSpan.FromTicks(eventLog.Timestamp.Ticks - command.Timestamp.Ticks); var toPublish = new OACommandExecuted(eventLog.Timestamp, command.Duration, Constants.SqlQueryExecuted, command.DisplayName) .AsTimedMessage(this.TimerStrategy.Stop(command.Offset)); toPublish.Duration = command.Duration; this.MessageBroker.Publish(toPublish); } return; } eventLog.DisplayName = OAGlimpseTraceListener.Metrics[eventLog.Name].Name; eventLog.Type = OAGlimpseTraceListener.Metrics[eventLog.Name].Type; OAGlimpseTraceListener.GetList().Add(eventLog); }
protected virtual object GetMetricsValue(OAEventLog eventLog) { return(null); }
private static string GetDurationMetricValue(OAEventLog eventLog) { int milliseconds = eventLog.Duration.Milliseconds; return(milliseconds == 0 ? null : string.Format("{0}ms", milliseconds)); }
protected override object GetMetricsValue(OAEventLog eventLog) { return(string.Format("{0}\n{1}", eventLog.Information, eventLog.StackTrace)); }