The log of Azure Function on Application Insights changed customDimensions name from prop__FunctionName to prop__functionName
See original GitHub issueRepro steps
- 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();
}
-
Create a new Azure Function (Windows) resource with Application Insights enabled, deploy the project. (When I test all deployed to West US 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:
- Created 3 years ago
- Reactions:1
- Comments:9 (2 by maintainers)
Top GitHub Comments
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.
Verified that the issue was fixed since 4/26 for our Azure Function resources. Thanks for the fix and close the issue.