public void Activated()
        {
            // Global configuration is application-wide, thus should happen only once.
            if (_shellSettings.Name != ShellSettings.DefaultName)
            {
                return;
            }

            var currentConfiguration = _telemetryConfigurationAccessor.GetCurrentConfiguration();

            if (currentConfiguration == null)
            {
                return;
            }

            var settingsPart = _siteService.GetSiteSettings().As <AzureApplicationInsightsTelemetrySettingsPart>();

            _appWideSetup.SetupAppWideServices(
                currentConfiguration,
                settingsPart.ApplicationWideDependencyTrackingIsEnabled,
                settingsPart.ApplicationWideLogCollectionIsEnabled);

            if (settingsPart.ApplicationWideLogCollectionIsEnabled)
            {
                _previousLogEntriesCollector.ReLogPreviousLogEntries();
            }
        }
        public TelemetryClient CreateTelemetryClientFromCurrentConfiguration()
        {
            var defaultConfiguration = _telemetryConfigurationAccessor.GetCurrentConfiguration();

            if (defaultConfiguration == null)
            {
                return(null);
            }
            return(CreateTelemetryClient(defaultConfiguration));
        }