public void OnResultExecuted(ResultExecutedContext context) { DimensionSelectors.ForEach(selector => { DimensionCollector.TryWhenEnabled(c => c.CollectActionResultDimensions(selector.GetActionResultDimensions(context))); }); }
public void OnActionExecuting(ActionExecutingContext context) { DimensionSelectors.ForEach(selector => { DimensionCollector.TryWhenEnabled(c => c.CollectActionDimensions(selector.GetActionExecutingDimensions(context))); }); }
protected override void OnInitializeTelemetry( HttpContext platformContext, RequestTelemetry requestTelemetry, ITelemetry telemetry) { var httpContext = platformContext.Request.HttpContext; var options = OptionsMonitor.CurrentValue; if (!(httpContext.Items[HttpContextProblemItemKey] is MvcProblemDetails problem)) { return; } if (httpContext.Items[HttpContextIsFailureItemKey] is bool isFailure) { requestTelemetry.Success = !isFailure; } if (!options.ShouldSend(httpContext, problem)) { return; } var choices = new DimensionChoices { IncludeErrorsValue = options.IncludeErrorsValue(httpContext, problem), IncludeExtensionsValue = options.IncludeExtensionsValue(httpContext, problem), IncludeRawJson = options.IncludeRawJson(httpContext, problem) }; var candidateDimensions = new Dictionary <string, string>(); DimensionCollector.CollectDimensions(candidateDimensions, problem, httpContext, choices); var dimensions = options.MapDimensions(httpContext, problem, candidateDimensions); if (dimensions == null) { return; } foreach (var(key, value) in dimensions) { requestTelemetry.Properties[key] = value; } }