I'm monitoring my Azure Function App costs from the Azure Cost Management tool, but from there, it isn't possible to get the cost for each different Azure Function within the app.
I've noticed an unexpected increase in costs and I'd like to know the which functions are costing more in order to make cost optimization.
Is it possible to get Azure Functions cost by function name?
There's no metric that specifies the exact cost of each azure function in a certain currency, but there are alternatives you can use in order to understand which function is above your limits of resource consumption.
If you really need to calculate the cost for each function, I advise you take a look at this article:
The execution cost of a single function execution is measured in GB-seconds. Execution cost is calculated by combining its memory usage with its execution time. A function that runs for longer costs more, as does a function that consumes more memory.
For example, say that your function consumed 0.5 GB for 3 seconds. Then the execution cost is 0.5GB * 3s = 1.5 GB-seconds
. This metric is called Function Execution Units. You will first need to create an Application Insights resource for your function app in order to have access to this metric.
This metric will help you to compare units between different functions and understand which one is consuming most, and so, having more costs.