'Azure Function with TimerTrigger shows execution count of 0 despite function running

I have a function app with a single, timer-triggered function running in MS Azure.

Background

  • The timer runs every 15 seconds with the following NCRONTAB expression: */15 * * * * *
  • Clicking on the "Monitor" tab in the Azure portal shows many successful executions on the expected interval (every 15 seconds)
  • I have proof that the function is indeed running as expected (behavior is to call a web API on each execution, and I can see from the other side of that API that it is indeed being called).

Problem

  • In the Azure portal on the "Overview" tab of the overall function app, the metric widget showing "Function Execution Count" constantly shows 0 executions.
  • I have attempted to set up an Azure Monitor Alerting Rule in which I am notified any time the single function in this function app has not run at least 15 times in the last 5 minutes. The alert rule is in a persistent state of being activated/fired, presumably since the overall function execution count is always 0.

Question

  • What might be causing the "Function Execution Count" metric not to update?
  • If it showing 0 is the expected behavior, what is the best practice for implementing an alert for a specific function on a timer trigger not firing as expected (or erroring)?


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source