Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Application Insights for a Web App deployed to multiple environments

I'm in the process of trialling MS Application Insgihts on a Web Application deployed to Azure.

One thing that doesn't seem to be available out of the box is segregation of stats/anayltics by deployment environment.

Just wondering has anyone done this already and how the went about achieving it?

Here's what I was thinking.

  • Create 4 seperate "Applications" within AI (each with their own App Name & Component Id)

  • Add a single ApplicationInsights.config to the Web Application Project

  • Manually Add App.Config Transforms to the application to replace the ComponentName & ComponentId at build time based on the Configuratoin (QA, UAT or Prod)

  • Add Conditional Compilation Symbols to the Web Application Build Configurations (QA, UAT, PROD)

  • Add "#if QA" pre-processor directives to the razor _layout view to swap in the correct ComponentId into the javascript snippet at build time.

Thoughts?

like image 918
Eoin Campbell Avatar asked Apr 09 '14 09:04

Eoin Campbell


1 Answers

Here is what we did.

  • Create 4 AI applications
  • In our ApplicationInsights.config we set it to our development componentId.
  • For Test, Stage, and Prod we use a build script that replaces the componentId and componentName based on which environment we are in.
  • In layout javascript get the appId:

    appInsights.start("@ServerAnalytics.ApplicationInsightsId");
    
like image 96
tmcc Avatar answered Oct 22 '22 03:10

tmcc