title | description | ms.topic | ms.date |
---|---|---|---|
Using Monitor Metrics with Azure Functions |
Learn how to use Azure Monitor Metrics to view and query for Azure Functions telemetry data collected by and stored in Azure Application Insights. |
how-to |
07/4/2021 |
Azure Functions integrates with Azure Monitor Metrics to let you analyze the metrics generated by your function app during execution. To learn more, see the Azure Monitor Metrics overview. These metrics indicate how your function app is running on the App Service platform. You can review resource consumption data used to estimate consumption plan costs. To investigate detailed telemetry from your function executions, including log data, you should also use Application Insights in Azure Monitor.
Azure Monitor collects numeric data from a set of monitored resources, which are entered into a time series database. Azure Monitor collects metrics specific to both Functions and the underlying App Service resources.
There are two metrics specific to Functions that are of interest:
Metric | Description |
---|---|
FunctionExecutionCount | Function execution count indicates the number of times your function app has executed. This value correlates to the number of times a function runs in your app. |
FunctionExecutionUnits | Function execution units are a combination of execution time and your memory usage. Memory data isn't a metric currently available through Azure Monitor. However, if you want to optimize the memory usage of your app, can use the performance counter data collected by Application Insights. This metric isn't currently supported for Premium and Dedicated (App Service) plans running on Linux. |
These metrics are used specifically when estimating Consumption plan costs.
Aside from function-specific metrics, the App Service platform implements more metrics, which you can use to monitor function apps. For the complete list, see metrics available to App Service apps.
You can use either Azure Monitor metrics explorer in the Azure portal or REST APIs to get Monitor Metrics data.
The following examples use Monitor Metrics to help estimate the cost of running your function app on a Consumption plan. To learn more about estimating Consumption plan costs, see Estimating Consumption plan costs.
[!INCLUDE functions-monitor-metrics-consumption]
To learn more about using Monitor Explorer to view metrics, see Getting started with Azure Metrics Explorer.
Learn more about monitoring Azure Functions: