I'd like to customize my Application Insights logging behavior. So I'd like to set some sort of flag in my ActionFilter and then read that flag in ITelemetryProcessor.
public class MyCustomFilterAttribute: ActionFilterAttribute
{
public override void OnActionExecuting(HttpActionContext filterContext)
{
//perform some logic and set the flag here
}
}
and then
public class TelemetryFilter : ITelemetryProcessor
{
public void Process(ITelemetry item)
{
var request = item as RequestTelemetry;
//read the flag here and terminate processing
}
}
Is that possible ? Is there some sort of TempData that's shared between those two types ? I'd like to avoid kind of hacks like setting temporary header and so on. Thanks in advance.