none
Application Insights Metric displaying incorrect stats? RRS feed

  • Question

  • Hi Team,

    When setting up metric alerts for Azure Function through App Insights, I noticed that the number of metric displayed on the status is incorrect when choosing Aggregation type of "Count".

    Example below is for a Function that has no failed runs and 8 successful runs, if you choose "Count" as the aggregation type, the value that it shows is the value of how many time has the function run successfully which is incorrect.

    

    Whereas if you choose any other aggregation type, it show the correct number of failed runs.

    Could you please advise if this behaviour is expected? Let me know if you have further questions.

    Thanks

    Friday, September 20, 2019 4:22 AM

Answers

  • Hi Harris,

    This is how the 'Count' metric works. It returns there unfiltered count of events.

    As you have noticed using the 'Total' aggregation will give you the results you are looking for. This is called 'Sum' for some metrics.

    You could use this in a scenario where you want to make sure that the function is firing. If you have a timer function that runs once a minute, you might check to see if it is firing at least 4 times in a five minute window. This gives a buffer in case the function fires a few seconds late pushing the last execution outside the five minute window. If it only fires twice, something is wrong in the app that is preventing the function from firing regardless of whether or not the timer function itself succeeded or failed.

    Friday, September 20, 2019 2:57 PM
    Moderator

All replies

  • Hi Harris,

    This is how the 'Count' metric works. It returns there unfiltered count of events.

    As you have noticed using the 'Total' aggregation will give you the results you are looking for. This is called 'Sum' for some metrics.

    You could use this in a scenario where you want to make sure that the function is firing. If you have a timer function that runs once a minute, you might check to see if it is firing at least 4 times in a five minute window. This gives a buffer in case the function fires a few seconds late pushing the last execution outside the five minute window. If it only fires twice, something is wrong in the app that is preventing the function from firing regardless of whether or not the timer function itself succeeded or failed.

    Friday, September 20, 2019 2:57 PM
    Moderator
  • Thanks for clarifying Samara, I was under the impression that Count will only show the number of failures because the metric is set to "Function Failures".

    Sunday, September 22, 2019 9:42 PM