private void Application_EndRequest(Object source, EventArgs e) { if (Statsd != null) { var application = (HttpApplication)source; var context = application.Context; var filePath = context.Request.FilePath; var fileExtension = VirtualPathUtility.GetExtension(filePath); if (fileExtension != null && fileExtension.Equals(".aspx")) { var stopwatch = (Stopwatch)context.Items[StopwatchKey]; stopwatch.Stop(); var hasException = false; if (context.Error != null) { hasException = true; Statsd.LogCount("exceptions", GetRouteData(context, hasException)); } Statsd.LogCount("request", GetRouteData(context, hasException)); Statsd.LogTiming("responses", stopwatch.ElapsedMilliseconds, GetRouteData(context, hasException)); } } }
public ITopicClientWrapper GetClient() { if (_failoverResolver.IsInFailover) { _statsDClient.LogCount(FAILOVER_METRIC); return(_failoverClient); } return(_topicClient); }
public ITopicClientWrapper GetClient() { if (_primaryClient.IsHealthy()) { return(_primaryClient); } _statsDClient?.LogCount(FAILOVER_METRIC); TryToExitFailover(); return(_failoverClient); }
public override void OnResultExecuted(ResultExecutedContext filterContext) { var routeData = GetRouteData(filterContext.HttpContext); if (filterContext.HttpContext.Items.Contains(StopwatchKey)) { var stopwatch = (Stopwatch)filterContext.HttpContext.Items[StopwatchKey]; stopwatch.Stop(); _statsd.LogTiming("responses", stopwatch.ElapsedMilliseconds, routeData); } _statsd.LogCount("request", routeData); if (filterContext.Exception != null) { _statsd.LogCount("exceptions", GetRouteData(filterContext.HttpContext)); } base.OnResultExecuted(filterContext); }
public override Task OnActionExecutedAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken) { var hasException = actionExecutedContext.Exception != null; var routeData = GetRouteData(actionExecutedContext.ActionContext, hasException); if (actionExecutedContext.Request.Properties.ContainsKey(StopwatchKey)) { var stopwatch = (Stopwatch)actionExecutedContext.Request.Properties[StopwatchKey]; stopwatch.Stop(); _statsd.LogTiming("responses", stopwatch.ElapsedMilliseconds, GetRouteData(actionExecutedContext.ActionContext, hasException)); } if (hasException) { _statsd.LogCount("exceptions", routeData); } _statsd.LogCount("request", routeData); return(base.OnActionExecutedAsync(actionExecutedContext, cancellationToken)); }
public virtual async Task SendAsync(BrokeredMessage message) { var stopwatch = Stopwatch.StartNew(); _statsd.LogCount("dependencies.servicebus.send"); _statsd.LogGauge("dependencies.servicebus.messagesize", (int)message.Size); await _topicClient.SendAsync(message).ConfigureAwait(false); stopwatch.Stop(); _statsd.LogTiming("dependencies.servicebus.send", stopwatch.ElapsedMilliseconds); }