I recently deployed a very simple Azure Functions 2.0 project from Visual Studio 2019 that contained a single timer triggered function. The function had a daily timer trigger and I noticed that there were gaps in the executions in the monitoring tab in the Azure portal.
I went looking in the associated storage account tables and in the AzureWebJobsHostLogs201905 table I could see entries with a partitionkey of \”R2\” that seemed to show that the executions were happening, but nothing was showing in monitoring.
I checked the Data Sampling in the associated Application Insights app in the Usage and estimated costs blade but it was set to 100%.
After lodging a support ticket with Microsoft, it seems that you also need to explicitly disable sampling in your hosts.json file for the Function App. The logging snippet below needs to be added to your hosts.json file prior to deployment. After adding this and re-deploying, all executions of this function have appeared.
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": false
}
}
}
}