As a preview feature, now we can have scale controller emit logs with reasoning to help understand why and how the application have scaled at various points. You will have to add a function configuration as SCALE_CONTROLLER_LOGGING_ENABLED=AppInsights:Verbose
. Then you can query your scale controller logs to know reason and instance count as in this microsoft
docs.
I modified the kusto query in the linked document to have a function scaling graph for past 24 hours
traces
| where customDimensions.Category == "ScaleControllerLogs"
| where customDimensions.Action == "ScaleResult"
| where customDimensions.AppName == "my-function-app-name"
| extend currentInstanceCount = toint(customDimensions.CurrentInstanceCount)
| make-series rawInstanceCounts = max(currentInstanceCount) default=-1 on timestamp in range(ago(24h), now(), 5m)
| extend instanceCountsForwardFilled = series_fill_forward(rawInstanceCounts, -1)
| project timestamp, instanceCountsForwardFilled
| render timechart
You may also emit scale controller logs to Blob Storage. In the above example, I chose AppInsights for quick queries. Also to avoid app insights pricing impact, consider disabling the config parameter once you understood the scaling behaviour.
bin()
does not autofill to 0. So this does not show when instance count reduces to zero. We can usemake_series
instead b) More importanly, on push based triggers like eventhub trigger, the function host does not do any activity to be logged into app insights. So app insights does not know whether host is alive or not. – Darrel