Cloud Role Name is missing after upgrading to latest stable version
-
List of NuGet packages and version using:
-
Runtime version :
- netcoreapp3.1
-
Hosting environment :
- Azure Kubernetes - Linux containers
Description
I have microservice written in .Net Core and recently, I upgraded my application to .Net Core 3.1.10 from 3.1.8. As a part of the upgrade above NuGet packages are updated as well. After upgrading cloud_RoleName is missing from Application Insights Traces. Previously, it was working with the below versions. When downgraded packages, cloud_RoleName starts appearing in Traces.
- Microsoft.ApplicationInsights.AspNetCore -- > ver. 2.14.0 (latest stable is 2.16.0)
- Microsoft.ApplicationInsights.Kubernetes --> ver. 1.1.2 (latest stable is 1.1.3)
- Serilog.Sinks.ApplicationInsights --> ver. 3.1.0 (latest stable is 3.1.0)
Custom Cloud Role Name is set using the below code. It was working and still works if the above-mentioned packages are downgraded
`internal class TelemetryInitializer : ITelemetryInitializer { private readonly string _roleName;
public TelemetryInitializer(string roleName)
{
_roleName = roleName;
}
public void Initialize(ITelemetry telemetry)
{
if (telemetry == null || telemetry.Context == null)
{
return;
}
telemetry.Context.Cloud.RoleName = _roleName;
}
}`
Steps to Reproduce
I have created below sample project which can help to reproduce issue. AI.Traces.CloudRoleName.zip
@NitinM3 Please share a repro without Serilog and ApplicationInsights.Kubernetes added, as these are components not shipped from this repo and we cannot help with that.
cloud_RoleName is missing from Application Insights Traces.
Are these traces captured via Serilog? The SDK version field in those traces will you more about "who" collected these traces. (if its via Serilog, need to get help from Serilog repo)
@cijothomas : When I removed Serilog and ApplicationInsights.Kubernetes packages, CloudRole Name starts populating. Seems like issue with Serilog package as it is incompatible with latest version. Thanks for the help. I will log an issue in the appropriate repo.
@NitinM3 Please share a repro without Serilog and ApplicationInsights.Kubernetes added, as these are components not shipped from this repo and we cannot help with that.
Working Sample without Serilog Without Serilog (working).zip
I am also encountering this issue and I'm using Microsoft.ApplicationInsights.WorkerService (2.16.0) Serilog.Sinks.ApplicationInsights (3.1.0)