question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The log of Azure Function on Application Insights changed customDimensions name from prop__FunctionName to prop__functionName

See original GitHub issue

Repro steps

  1. Create a new Azure Function project (HTTP trigger) with following codes
        [FunctionName("Function1")]
        public static IActionResult Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req,
            ILogger log)
        {
            using (log.BeginScope(new Dictionary<string, object> { ["FunctionName"] = "Test" }))
            {
                log.LogInformation("C# HTTP trigger function processed a request.");
            }

            return new OkResult();
        }
  1. Create a new Azure Function (Windows) resource with Application Insights enabled, deploy the project. (When I test all deployed to West US 2).

  2. Test run and wait for the log available.

Expected behavior

The trace looks like customDimensions={ "prop__FunctionName" : "Test" } (Uppercase for F)

Actual behavior

The trace looks like customDimensions={ "prop__functionName" : "Test" } (lowercase for f).

Known workarounds

Not found.

Related information

I noticed this issue recently (our other Azure resources read the prop_functionName) and found that the behavior changed since 2/4, with different SDK versions on that day.

I ran following query on Application Insights around 2/4

traces
traces
| where not (message startswith "Executing '" or message startswith "Executed '" or message startswith "Stopped the listener" or message startswith "Stopping the listener")
| summarize f = countif(tostring(customDimensions.prop__functionName) != ''), F = countif(tostring(customDimensions.prop__FunctionName) != '') by sdkVersion, bin(timestamp, 1d)
| order by timestamp asc

Here is the result

timestamp [UTC] skdVersion f F
2/2/2021, 12:00:00.000 AM azurefunctions: 3.0.15193.0 0 12,017
2/3/2021, 12:00:00.000 AM azurefunctions: 3.0.15193.0 0 12,580
2/4/2021, 12:00:00.000 AM azurefunctions: 3.0.15371.0 567 0
2/4/2021, 12:00:00.000 AM azurefunctions: 3.0.15193.0 0 12,232
2/5/2021, 12:00:00.000 AM azurefunctions: 3.0.15371.0 10,893 0
2/6/2021, 12:00:00.000 AM azurefunctions: 3.0.15371.0 181 0

According to the result, the change happens along with the SDK version update from 3.0.15193 to 3.0.15371.

My question is that is the behavior change expected (e.g., functionName is a preserved word now)? If the change is expected, we would change our project to use another value to replace FunctionName.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
mathewccommented, Apr 5, 2021

Guys - I just sent a PR https://github.com/Azure/azure-webjobs-sdk/pull/2691 fixing this issue. Please have a look. We’ll expedite this into our next release.

0reactions
FanBaoMScommented, May 19, 2021

Verified that the issue was fixed since 4/26 for our Azure Function resources. Thanks for the fix and close the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom dimension in app insight changed name for ...
We implemented the Azure Function in C# and use the ILogger's BeginScope to add FunctionName as a custom dimension in app insights. using...
Read more >
Configure monitoring for Azure Functions
Learn how to connect your function app to Application Insights for monitoring and how to configure data collection.
Read more >
Analyze Azure Functions telemetry in Application Insights
Learn how to view and query for Azure Functions telemetry data collected by and stored in Azure Application Insights.
Read more >
Azure function running but no "requests" showing up in ...
Azure function running but no "requests" showing up in App Insights ... This App Insights query yields up-to-date data for the function:.
Read more >
Adding Custom Dimension to Request Telemetry - Azure ...
After running this function, go to the Application Insights Search could check the data Or go to Logs(Analytics).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found