Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Significance of Application Insights csproj file modifications

When I use the "Add Application Insights Telemetry..." menu option available from right-clicking an ASP.NET application in the Solution Explorer in Visual Studio to point an application to an existing Application Insights resource, the resulting file changes include the addition of two items to the .csproj file:

<ApplicationInsightsResourceId>/subscriptions/$guid/resourcegroups/$rgname>/providers/microsoft.insights/components/$name</ApplicationInsightsResourceId>
<ApplicationInsightsAnnotationResourceId>/subscriptions/$guid/resourcegroups/$rgname/providers/microsoft.insights/components/$name</ApplicationInsightsAnnotationResourceId>

I have elided some information - $guid is the Azure subscription GUID and $rgname and $name are the names given to the Application Insights resource group and resource respectively.

  1. What is the difference between each element? They seem to have the same information.

  2. If I want to send telemetry to different Application Insights resources in difference environments, the documentation tells me I need to set the instrumentation key for each environment in code - which is fine - but what about these settings? Are they used for anything other than driving the context-sensitive menu options in Visual Studio? Do I need to worry about them in other environments?

like image 781
James World Avatar asked Feb 07 '17 14:02

James World


People also ask

Does application Insights affect performance?

The Application Insights SDK and instrumentation is designed to be extremely lightweight and have minimal impact on the performance of your application.

Should I use single or multiple application Insights resources?

As per the FAQ: use one instance: Should I use single or multiple Application Insights resources? Use a single resource for all the components or roles in a single business system. Use separate resources for development, test, and release versions, and for independent applications.

Is instrumentation key must if you want to use Appinsight for monitoring web application?

You need the instrumentation keys of all the resources to which your app will send data.

What is application insight?

Application Insights is a feature of Azure Monitor that provides extensible application performance management (APM) and monitoring for live web apps. Developers and DevOps professionals can use Application Insights to: Automatically detect performance anomalies. Help diagnose issues by using powerful analytics tools.


Video Answer


1 Answers

These are purely for use inside Visual Studio tools. They are in the csproj so all users who get your project (out of source control) or whatever, all have the values. (if it was stored in the registry or .suo or other non-source places, it wouldn't "travel" with the project)

ApplicationInsightsResourceId is the resource id of the project which is used to display information in the configuration window about what resource VS thinks you are sending data to. This is also used by default to show data in codelens/etc. You can override this in the configure window to pick a different resource (like if you have data sent to a debug/staging resource when developing, but always want codelens/other tools to show data from prod always) Changing the resource inside the configuration window will set this property (and will update the ikey in your applicationinsights.config file)

ApplicationInsightsAnnotationResourceId is the resource that VS will try to submit publish release annotations to if you publish your web app from inside Visual Studio. you can change this resource (or turn of this behavior entirely) from inside the configuration window as well. If you don't publish from inside VS, this setting doesn't do anything.

These settings do not affect where the data actually goes at runtime, If you are setting your instrumentation key in code your data will still go there.

like image 107
John Gardner Avatar answered Oct 11 '22 05:10

John Gardner