Application Insights and Tags

偶尔善良 提交于 2021-01-29 03:16:20

问题


I have 2 applications (asp.net) with Application Insights integrated. In the portal I have created 2 tags: App1 = 1, App2 = 1 (one tag for each app). But what is the next step? How do I add the tags into the ApplicationInsights.config, so that each app sends its tag?


回答1:


That's not where tags are for. They are there to organize your Azure resources, see https://docs.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.

If you want to make a distinction between the two apps you need to use different instrumentation keys, meaning two distinct Application Insights environments.

From https://docs.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.

As an alternative you could add custom properties to your SDK calls to make a distinction if that is what you need as outlined here: https://blogs.msdn.microsoft.com/visualstudioalm/2015/01/07/application-insights-support-for-multiple-environments-stamps-and-app-versions/ and Adding custom properties for each request in Application Insights metrics

So it depends on the web application differences. If they are unrelated I would suggest using different instrumentation keys. If one app is a staging/test app and the other is the production app then you can consider using custom properties so you can compare the gathered data based on the custom property.



来源:https://stackoverflow.com/questions/41417656/application-insights-and-tags

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!