private void LogException(string correlationId, Exception exception) { var client = ApplicationInsights.CreateTelemetryClient(); client.TrackRestAPIException(correlationId, exception); client.Flush(); }
public async Task <JsonResult> WipeClaims() { string message; var service = new AdminService(); try { await service.WipeClaimsAsync(); message = "All claims have been wiped."; } catch (Exception ex) { message = "Failed to wipe all claims. " + ex.Message; var telemetryClient = ApplicationInsights.CreateTelemetryClient(); telemetryClient.TrackWebAppException(ex); telemetryClient.Flush(); } var result = new { message = message }; return(Json(result)); }
public void OnException(ExceptionContext filterContext) { var client = ApplicationInsights.CreateTelemetryClient(); client.TrackWebAppException(string.Empty, filterContext.Exception); client.Flush(); }
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) { if (actionExecutedContext.Exception != null) { return; } var correlationId = actionExecutedContext.ActionContext.ActionArguments[Constants.CorrelationIdKey] as string; var client = ApplicationInsights.CreateTelemetryClient(); var status = actionExecutedContext.Response.IsSuccessStatusCode ? OperationStatus.Success : OperationStatus.Failure; client.TrackRestAPIStatus(correlationId, Description, status); client.Flush(); }
public override void OnActionExecuted(ActionExecutedContext filterContext) { var client = ApplicationInsights.CreateTelemetryClient(); if (filterContext.Exception == null) { var status = IsSuccess(filterContext.HttpContext.Response.StatusCode) ? OperationStatus.Success : OperationStatus.Failure; client.TraceWebAppStatus(CorrelationId, Description, status); } else { client.TraceWebAppException(CorrelationId, filterContext.Exception); } client.Flush(); }