Working packages:
- Microsoft.ApplicationInsights 2.23.0
- Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel 2.23.0
Broken packages
- Microsoft.ApplicationInsights 3.x
Runtime: aspnetcore9.0
Hosting environment: any
The changes to proxy AvailabilityTelemetry through ILogger + the OpenTelemetry exporter in the 3.x builds lose the otel trace/span info that previously worked. This previously worked:
private static void AddAvailabilitySpanInfo(AvailabilityTelemetry telemetryItem, Activity? activity)
{
if (activity != null)
{
telemetryItem.Id = activity.SpanId.ToString();
}
AddTelemetryParentIds(telemetryItem, activity);
}
private static void AddTelemetryParentIds(ITelemetry telemetryItem, Activity? activity)
{
if (activity != null)
{
telemetryItem.Context.Operation.Id = activity.TraceId.ToString();
if (activity.ParentId != null)
{
telemetryItem.Context.Operation.ParentId = activity.ParentSpanId.ToString();
}
}
}
but now the otel trace/span info is lost. I've verified by code reviewing both this repo and the otel exporter in the azure-sdk-for-net that the span info in the legacy TelemetryContext.Operation is not accounted for.
Modelling an AvailabilityResult as a LogRecord is potentially problematic because an AvailabilityResult has span semantics (it has a duration and can be a non-leaf node in the trace tree). The ApplicationInsights UI gets this correct, eg this is how our health reporting looks using ApplicationInsights 2.23.0 client lib:
So if you want to push an AvailabilityTelemetry through an ILogger to a LogRecord you're going to have to come up with a representation for the TraceId and ParentSpanId that can be restored within the Availability entry in the otel exporter.
We are 90% migrated to OpenTelemetry - the only reason we still have a dependency on the ApplicationInsights (classic/legacy) library is for Availability reporting. So it would be better for us to be able to log Availability entries directly (via the otel exporter or preferably an Api client), then we could drop the ApplicationInsights libraries. But we'd still need a way to specify the activity/span info for each Availability entry - currently there is none. I've tried doing this purely using ILogger and using the Availability properties, and I can create the Availability telemetry this way except for the span properties.
Of course I would feel more comfortable if there was a strong API (eg service API client) for reporting availability telemetry, vs a set of dictionary keys passed to an ILogger that could change at any time.
To be clear: We can't upgrade to ApplicationInsights 3.x until this is addressed, and/or we can't migrate to the otel exporter library only until there is a way to report AvailabilityTelemetry where we can specify the TraceId and ParentSpanId.
Working packages:
Broken packages
Runtime: aspnetcore9.0
Hosting environment: any
The changes to proxy AvailabilityTelemetry through ILogger + the OpenTelemetry exporter in the 3.x builds lose the otel trace/span info that previously worked. This previously worked:
but now the otel trace/span info is lost. I've verified by code reviewing both this repo and the otel exporter in the azure-sdk-for-net that the span info in the legacy
TelemetryContext.Operationis not accounted for.Modelling an AvailabilityResult as a LogRecord is potentially problematic because an AvailabilityResult has span semantics (it has a duration and can be a non-leaf node in the trace tree). The ApplicationInsights UI gets this correct, eg this is how our health reporting looks using ApplicationInsights 2.23.0 client lib:
So if you want to push an AvailabilityTelemetry through an ILogger to a LogRecord you're going to have to come up with a representation for the TraceId and ParentSpanId that can be restored within the Availability entry in the otel exporter.
We are 90% migrated to OpenTelemetry - the only reason we still have a dependency on the ApplicationInsights (classic/legacy) library is for Availability reporting. So it would be better for us to be able to log Availability entries directly (via the otel exporter or preferably an Api client), then we could drop the ApplicationInsights libraries. But we'd still need a way to specify the activity/span info for each Availability entry - currently there is none. I've tried doing this purely using ILogger and using the Availability properties, and I can create the Availability telemetry this way except for the span properties.
Of course I would feel more comfortable if there was a strong API (eg service API client) for reporting availability telemetry, vs a set of dictionary keys passed to an ILogger that could change at any time.
To be clear: We can't upgrade to ApplicationInsights 3.x until this is addressed, and/or we can't migrate to the otel exporter library only until there is a way to report AvailabilityTelemetry where we can specify the TraceId and ParentSpanId.