Cloud role name in application insights
- Dominant language
- PowerShell
- Stars
- 1.1k
- Forks
- 215
- Avg merge
- 4h 2m
- Merged PRs (30d)
- 1
Description
After enabling application insights in a NET 8 Azure function in isolated mode, the cloud role name set fot the telemetry is the name of the function app in azure. I am not able to change it using a Telemetry Initializer as documented in https://learn.microsoft.com/en-us/azure/azure-monitor/app/app-map?tabs=net#set-cloud-role-names.
TelemetryInitializer:
```csharp
public class CloudRoleNameTelemetryInitializer : ITelemetryInitializer
{
public void Initialize(ITelemetry telemetry)
{
telemetry.Context.Cloud.RoleName = "MyRolName";
}
}
```
Function app program
```csharp
var host = new HostBuilder()
.ConfigureFunctionsWebApplication()
.ConfigureServices(services =>
{
services.AddApplicationInsightsTelemetryWorkerService();
services.ConfigureFunctionsApplicationInsights();
services.AddSingleton();
})
.Build();
host.Run();
```
Requests are using the funcion app name as the cloud role name.
However traces (logs) are using the cloud role name I set in the telemetry initializer

Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.