Azure function running but no "requests" showing up in App Insights

Donnie Hale 0 Reputation points
2023-05-25T15:23:07.8566667+00:00

The issue I'm seeing seems similar to this question: https://learn.microsoft.com/en-us/answers/questions/845195/application-insights-not-showing-request-data

However, my host.json already has the relevant settings:

{
  "version": "2.0",
  "logging": {
    "logLevel": {
      "default": "Warning",
      "Function.MyFunctionName": "Information"
    },
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  }
}

This App Insights query yields up-to-date data for the function:

# "traces" - returns up-to-date data for the "every 15 minute" runs
traces
| project
    timestamp,
    operation_Name,
    operation_Id,
    cloud_RoleName,
    invocationId=customDimensions['InvocationId']
| where timestamp > ago(30d)
| where cloud_RoleName =~ 'my-function-azure-resource' and operation_Name =~ 'MyFunctionName'
| order by timestamp desc
| take 20

But this query doesn't return current data:

# "requests" - returns no data after 2023-05-24 7:33 PM UTC
requests
| project
    timestamp,
    id,
    operation_Name,
    success,
    resultCode,
    duration,
    operation_Id,
    cloud_RoleName,
    invocationId=customDimensions['InvocationId']
| where timestamp > ago(30d)
| where cloud_RoleName =~ 'my-function-azure-resource' and operation_Name =~ 'MyFunctionName'
| order by timestamp desc
| take 20

In case it's important, I know the function is running by the side effects it creates when it runs. But of course the "trace" records are sufficient to prove that it's running.

What do I need to do to troubleshoot this and, more importantly, to correct the problem?

Thanks.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,936 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Devaraj Ranganathan 30 Reputation points
    2023-09-21T09:05:49.7866667+00:00

    Set "Host.Results": "Information" in the host.json { "version": "2.0", "logging": {
    "samplingSettings": { "isEnabled": true, "excludedTypes": "Request" }, "enableLiveMetricsFilters": true }, "logLevel": { "default": "Information", "Function": "Information", "Host.Aggregator": "Trace", "Host.Results": "Information" }
    }

    3 people found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.