open-telemetry / opentelemetry-dotnet-contrib

This repository contains set of components extending functionality of the OpenTelemetry .NET SDK. Instrumentation libraries, exporters, and other components can find their home here.
https://opentelemetry.io
Apache License 2.0
478 stars 284 forks source link

Application Insights does not recognize resource detected by Azure Container Apps detector as Azure resource #2112

Open hansmbakker opened 2 months ago

hansmbakker commented 2 months ago

Component

OpenTelemetry.Resources.Azure

Package Version

Package Name Version
OpenTelemetry 1.9.0

Runtime Version

net8.0

Description

I’m using Aspire.NET which has support for OpenTelemetry export to Application Insights. It uses the AzureContainerAppsResourceDetector which enables some Container App properties to be correctly ingested in Application Insights – like its Application Map.

However, when inspecting a node’s Compute details, it says

We didn't detect any Azure resources connected to backend. If you know that this should be connected to an Azure resource, your current Application Insights SDK/Agent may not support this detection.”

I read Migrate from Application Insights .NET SDKs to Azure Monitor OpenTelemetry - Azure Monitor | Microsoft Learn and Application map in Azure Application Insights - Azure Monitor | Microsoft Learn but those pages do not give me any pointers.

image

Steps to Reproduce

Create a basic Aspire.NET app. Run it in Container Apps Send the opentelemetry to Application Insights

Expected Result

The container app is recognized as an Azure resource in the Application Insights Application Map. It is possible to see the compute details when selecting the node.

Actual Result

The container app is detected but only marked with its app name. Azure Application insights does not recognize what Azure resource it belongs to. The Compute blade on the Application Map is empty for the given node.

Additional Context

This is also sent to OTel@microsoft.com.

The detector sets

but this might not be enough. Maybe Application Insights is expecting a full resource id (incl. subscription id and resource group name) in one of these properties or another property? The documentation at Understand cloud role names and nodes does not clearly state that this would be required, though.

TimothyMothra commented 2 months ago

Hi @hansmbakker, What version of OpenTelemetry.Resources.Azure are you using? Beta 9 was released recently which added more support for Container Apps.


Since you're having issues with Application Insight's UX, you should open a support ticket:

You can do so by going online to the Azure portal and submitting a support request. Access to subscription management and billing support is included with your Microsoft Azure subscription, and technical support is provided through one of the Azure Support Plans. For step-by-step guidance for the Azure portal, see How to create an Azure support request.

hansmbakker commented 2 months ago

Hi @TimothyMothra, I'm using the latest version.

I know support for container app jobs was added in beta 9, I was the author of that PR (#2064) :) and support for normal container apps was in a bit longer already.

Both of these resource detectors only add the name of the container app (job), so that it is not listed as unknown_service:dotnet (and some other metadata like revision / instance).

That works, but the issue is that the link to the actual azure compute resource in Application Insights does not work, and there is no documentation on how to make this work (what property needs to be set to what value).

I also reported this to OTel@microsoft.com.