/// <summary> /// Set up monitoring + notifications for WebJob errors. This shows how to set things up /// manually on startup. You can also use <see cref="ErrorTriggerAttribute"/> to designate /// error handler functions. /// </summary> private static void ConfigureTraceMonitor(JobHostConfiguration config, SendGridConfiguration sendGridConfiguration) { var notifier = new ErrorNotifier(sendGridConfiguration); var traceMonitor = new TraceMonitor() .Filter(new SlidingWindowTraceFilter(TimeSpan.FromMinutes(5), 3)) .Filter(p => { FunctionInvocationException functionException = p.Exception as FunctionInvocationException; return p.Level == TraceLevel.Error && functionException != null && functionException.MethodName == "ExtensionsSample.FileSamples.ImportFile"; }, "ImportFile Job Failed") .Subscribe(notifier.WebNotify, notifier.EmailNotify) .Throttle(TimeSpan.FromMinutes(30)); config.Tracing.Tracers.Add(traceMonitor); }
/// <summary> /// Set up monitoring + notifications for WebJob errors. This shows how to set things up /// manually on startup. You can also use <see cref="ErrorTriggerAttribute"/> to designate /// error handler functions. /// </summary> private static void ConfigureTraceMonitor(JobHostConfiguration config, SendGridConfiguration sendGridConfiguration) { var notifier = new ErrorNotifier(sendGridConfiguration); var traceMonitor = new TraceMonitor() .Filter(new SlidingWindowTraceFilter(TimeSpan.FromMinutes(5), 3)) .Filter(p => { FunctionInvocationException functionException = p.Exception as FunctionInvocationException; return(p.Level == TraceLevel.Error && functionException != null && functionException.MethodName == "ExtensionsSample.FileSamples.ImportFile"); }, "ImportFile Job Failed") .Subscribe(notifier.WebNotify, notifier.EmailNotify) .Throttle(TimeSpan.FromMinutes(30)); config.Tracing.Tracers.Add(traceMonitor); }