c# - 应用程序见解和标签

标签 c# asp.net azure azure-application-insights

我有 2 个集成了 Application Insights 的应用程序 (asp.net)。 在门户中,我创建了 2 个标签:App1 = 1、App2 = 1(每个应用程序一个标签)。 但下一步是什么? 如何将标签添加到 ApplicationInsights.config 中,以便每个应用程序发送其标签?

最佳答案

这不是标签的用途。它们用于组织您的 Azure 资源,请参阅 https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-using-tags .

Resource Manager enables you to logically organize resources by applying tags. The tags consist of key/value pairs that identify resources with properties that you define. To mark resources as belonging to the same category, apply the same tag to those resources.

如果您想区分这两个应用,则需要使用不同的检测键,这意味着两个不同的 Application Insights 环境。

来自https://learn.microsoft.com/en-us/azure/application-insights/app-insights-create-new-resource :

The instrumentation key identifies the resource that you created. You'll need it to give to the SDK.

作为替代方案,您可以将自定义属性添加到 SDK 调用中以区分是否需要,如下所述:https://blogs.msdn.microsoft.com/visualstudioalm/2015/01/07/application-insights-support-for-multiple-environments-stamps-and-app-versions/Adding custom properties for each request in Application Insights metrics

所以这取决于网络应用程序的差异。如果它们不相关,我建议使用不同的仪器键。如果一个应用程序是登台/测试应用程序,另一个应用程序是生产应用程序,那么您可以考虑使用自定义属性,以便您可以根据自定义属性比较收集的数据。

关于c# - 应用程序见解和标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41417656/

相关文章:

c# - 将项目添加到组合框

c# - 是否可以根据其值设置组合框的selectedIndex

jquery - ASP.NET MVC + 使用 jquery ajax 发送编码字符串

c# - 如何造成线程竞争情况

c# - 在 C# 中读取/写入结构化二进制数据的最佳方式是什么

c# - 发送 "on behalf of"电子邮件

asp.net - Web 部署项目构建不再属于项目的文件

azure - 微软地址验证API

azure - 通过 ARM 创建对自定义事件网格主题的存储队列订阅

c# - Serilog + Azure - Log Analytics 工作区中没有出现自定义日志