我有 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/