【发布时间】:2018-07-03 08:12:26
【问题描述】:
我想自定义我的 Application Insights 日志记录行为。所以我想在我的 ActionFilter 中设置某种标志,然后在 ITelemetryProcessor 中读取该标志。
public class MyCustomFilterAttribute: ActionFilterAttribute
{
public override void OnActionExecuting(HttpActionContext filterContext)
{
//perform some logic and set the flag here
}
}
然后
public class TelemetryFilter : ITelemetryProcessor
{
public void Process(ITelemetry item)
{
var request = item as RequestTelemetry;
//read the flag here and terminate processing
}
}
这可能吗?这两种类型之间是否共享某种 TempData ?我想避免像设置临时标题等那样的黑客行为。提前致谢。
【问题讨论】:
标签: c# azure asp.net-web-api azure-application-insights actionfilterattribute