private static void ConfigureTelemetry()

in RESTProxy/App_Start/WebApiConfig.cs [74:96]


        private static void ConfigureTelemetry(HttpConfiguration config)
        {
            // Sets the default configuration for any newly created TelemetryClient
            string appInsightsKey = string.Empty;
            if (RoleEnvironment.IsAvailable)
            {
                appInsightsKey = CloudConfigurationManager.GetSetting("APPINSIGHTS_INSTRUMENTATIONKEY");
            }

            if (!string.IsNullOrWhiteSpace(appInsightsKey))
            {
                // If we have an instrumentation key, configure App Insights
                TelemetryConfiguration.Active.InstrumentationKey = appInsightsKey;
            }
            else
            {
                // Otherwise, disable it
                TelemetryConfiguration.Active.DisableTelemetry = true;
            }

            // Causes any unhandled exception to be logged to Application Insights.
            config.Services.Add(typeof(IExceptionLogger), new AiExceptionLogger());
        }