ASP.NET 核心 - 配置 Application Insight 以使用许多应用程序

ASP.NET Core - configuring Application Insight to work with many applications

我有很多 ASP.NETCore 个应用程序和一个 Azure Application Insight 资源。我想从我的所有应用程序中收集数据,并能够区分哪些信息来自哪个应用程序。

我在配置 ApplicationInsightTelemetry 以设置应用程序 ID 或类似内容时没有看到任何选项。有什么方法可以告诉 Application Insight 信息来自哪个应用程序?

我的示例配置:

builder.Services.AddApplicationInsightsTelemetry(new ApplicationInsightsServiceOptions()
{
     ConnectionString = "InstrumentationKey=00000000-0000-0000-0000-000000000000;",
}) 

您正在查找的属性是 Cloud Role NameCloud Role Instance。 Application Insights SDK 和代理会尝试自动设置这些,但您也可以覆盖它们。可以找到一些进一步的阅读 here.