Search code examples
azureazure-functionsazure-cost-calculation

Hot to get Azure Function cost for each function in the Azure function app?


I'm monitoring my Azure Function App costs from Azure cost management tool, but from there, it isn't possible to get the cost for each different function in the app.

Now I've noticed an unexpected increase in costs and I'd like to know the functions which are costing more in order to make cost optimization.

Is it possible to get azure functions cost by function name?


Solution

  • 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.

    enter image description here

    See also: