public static T AsTimelineMessage <T>(this T message, TimelineCategoryItem eventCategory, string eventSubText = null) where T : ITimelineMessage { message.AsTimelineMessage(string.Empty, eventCategory, eventSubText); return(message); }
public WindowsAzureStorageTimelineMessage(string serviceName, string serviceOperation, string resourceUri, int responseCode, DateTime startTime, DateTime endTime, TimeSpan offset, RequestEventArgs requestEventArgs) { Id = Guid.NewGuid(); EventName = string.Format("WAZStorage:{0} - {1} {2} {3}", serviceName, serviceOperation, resourceUri, responseCode); EventCategory = new TimelineCategoryItem("Windows Azure Storage", "#0094FF", "#0094FF"); ServiceName = serviceName; ServiceOperation = serviceOperation; Url = resourceUri; ResponseCode = responseCode; StartTime = startTime; Duration = endTime - startTime; Offset = offset; RequestSize = requestEventArgs.Request.ContentLength; foreach (var header in requestEventArgs.Request.Headers.AllKeys) { RequestSize += header.Length + 2 + string.Join(";", requestEventArgs.Request.Headers.GetValues(header)).Length; } ResponseSize = requestEventArgs.Response.ContentLength; foreach (var header in requestEventArgs.Response.Headers.AllKeys) { ResponseSize += header.Length + 2 + string.Join(";", requestEventArgs.Response.Headers.GetValues(header)).Length; } RequestHeaders = requestEventArgs.Request.Headers; ResponseHeaders = requestEventArgs.Request.Headers; EventSubText = string.Format("out: {0}/in: {1}", RequestSize.ToBytesHuman(), ResponseSize.ToBytesHuman()); }
public void ShouldBeAbleToBuildWithFactory(TimerResult timerResult, string eventName, TimelineCategoryItem eventCategory, string eventSubText) { var testMessage = new TestMessage().AsTimelineMessage(eventName, eventCategory, eventSubText); Assert.Equal(eventName, testMessage.EventName); Assert.Equal(eventCategory, testMessage.EventCategory); Assert.Equal(eventSubText, testMessage.EventSubText); }
public static T AsTimelineMessage <T>(this T message, string eventName, TimelineCategoryItem eventCategory, string eventSubText = null) where T : ITimelineMessage { message.EventName = eventName; message.EventCategory = eventCategory; message.EventSubText = eventSubText; return(message); }
internal static OngoingCapture Capture(string eventName, string eventSubText, TimelineCategoryItem category, ITimelineMessage message) { if (string.IsNullOrEmpty(eventName)) { throw new ArgumentNullException("eventName"); } #pragma warning disable 618 var executionTimer = GlimpseConfiguration.GetConfiguredTimerStrategy()(); var messageBroker = GlimpseConfiguration.GetConfiguredMessageBroker(); #pragma warning restore 618 if (executionTimer == null || messageBroker == null) { return OngoingCapture.Empty(); } return new OngoingCapture(executionTimer, messageBroker, eventName, eventSubText, category, message); }
public Message(string cacheName, string operationType) // , DateTime startTime, DateTime endTime, TimeSpan offset) { Id = Guid.NewGuid(); EventName = string.Format("WAZCache:{0}:{1}", cacheName, operationType); EventCategory = new TimelineCategoryItem("Windows Azure Caching", "#0094FF", "#0094FF"); // StartTime = startTime; // Duration = endTime - startTime; // Offset = offset; // RequestSize = requestEventArgs.Request.ContentLength; // foreach (var header in requestEventArgs.Request.Headers.AllKeys) // { // RequestSize += header.Length + 2 + string.Join(";", requestEventArgs.Request.Headers.GetValues(header)).Length; // } // ResponseSize = requestEventArgs.Response.ContentLength; // foreach (var header in requestEventArgs.Response.Headers.AllKeys) // { // ResponseSize += header.Length + 2 + string.Join(";", requestEventArgs.Response.Headers.GetValues(header)).Length; // } // EventSubText = string.Format("out: {0}/in: {1}", RequestSize.ToBytesHuman(), ResponseSize.ToBytesHuman()); }
internal static void CaptureMoment(string eventName, string eventSubText, TimelineCategoryItem category, ITimelineMessage message) { if (string.IsNullOrEmpty(eventName)) { throw new ArgumentNullException("eventName"); } #pragma warning disable 618 var executionTimer = GlimpseConfiguration.GetConfiguredTimerStrategy()(); var messageBroker = GlimpseConfiguration.GetConfiguredMessageBroker(); #pragma warning restore 618 if (executionTimer == null || messageBroker == null) { return; } message .AsTimelineMessage(eventName, category, eventSubText) .AsTimedMessage(executionTimer.Point()); messageBroker.Publish(message); }
internal static void CaptureMoment(string eventName, TimelineCategoryItem category, ITimelineMessage message) { CaptureMoment(eventName, null, category, message); }
internal static OngoingCapture Capture(string eventName, TimelineCategoryItem category, ITimelineMessage message) { return Capture(eventName, null, category, message); }
public OngoingCapture(IExecutionTimer executionTimer, IMessageBroker messageBroker, string eventName, string eventSubText, TimelineCategoryItem category, ITimelineMessage message) { Offset = executionTimer.Start(); ExecutionTimer = executionTimer; Message = message.AsTimelineMessage(eventName, category, eventSubText); MessageBroker = messageBroker; }