コード例 #1
0
        private void InitializeSession()
        {
            if (!isSessionStarted)
            {
                lock (InitializationSyncRoot)
                {
                    if (!isSessionStarted)
                    {
                        this.instrumentationKeyLoadingTask = this.LoadInstrumentationKey();

                        if (this.TelemetryClient != null)
                        {
                            //flushing the telemetry client is a synchronous blocking operation.
                            //As it is used during initialization, it may slow down the startup of the app
                            Task.Run(async() =>
                            {
                                string cloudKey = await this.instrumentationKeyLoadingTask;
                                if (!string.IsNullOrEmpty(cloudKey))
                                {
                                    TelemetryClientBuilder builder             = new TelemetryClientBuilder(this.telimenaProperties);
                                    this.telimenaProperties.InstrumentationKey = cloudKey;
                                    this.TelemetryClient = builder.GetClient();
                                }
                                this.InitializeContext();
                            });
                            isSessionStarted = true;
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: TelemetryModule.cs プロジェクト: lulzzz/Telimena
        /// <summary>
        /// Initializes the telemetry client.
        /// </summary>
        public void InitializeTelemetryClient()
        {
            TelemetryClientBuilder builder = new TelemetryClientBuilder(this.telimenaProperties);

            this.TelemetryClient = builder.GetClient();
            this.InitializeSession();
        }
コード例 #3
0
ファイル: TelemetryModule.cs プロジェクト: lulzzz/Telimena
        internal void InitializeTelemetryClient(ITelemetryChannel channel)
        {
            TelemetryClientBuilder builder = new TelemetryClientBuilder(this.telimenaProperties);

#pragma warning disable 618
            this.TelemetryClient = builder.GetClient(channel);
#pragma warning restore 618
            this.InitializeSession();
        }