コード例 #1
0
        public void VerifyExperimentalFeaturesExtension()
        {
            var telemetryConfiguration = new TelemetryConfiguration();

            telemetryConfiguration.ExperimentalFeatures.Add("123");

            bool value = telemetryConfiguration.EvaluateExperimentalFeature("123");

            Assert.IsTrue(value);

            bool fakeValue = telemetryConfiguration.EvaluateExperimentalFeature("fake");

            Assert.IsFalse(fakeValue);
        }
コード例 #2
0
        public void VerifyExperimentalFeaturesExtensionIfConfigEmpty()
        {
            var telemetryConfiguration = new TelemetryConfiguration();

            bool value = telemetryConfiguration.EvaluateExperimentalFeature("abc");

            Assert.IsFalse(value);
        }
コード例 #3
0
        /// <summary>
        /// Initialize method is called after all configuration properties have been loaded from the configuration.
        /// </summary>
        public void Initialize(TelemetryConfiguration configuration)
        {
            /*
             * The configuration that is being passed into this method is the configuration that is the reason
             * why this instance of telemetry processor was created. Regardless of which instrumentation key is passed in,
             * this telemetry processor will only collect for whichever instrumentation key is specified by the module in StartCollection call.
             */

            this.EvaluateDisabledTrackingProperties = configuration.EvaluateExperimentalFeature(ExperimentalConstants.DeferRequestTrackingProperties);

            this.Register();
        }
        /// <summary>
        /// Initializes the telemetry module.
        /// </summary>
        /// <param name="configuration">Telemetry configuration to use for initialization.</param>
        public void Initialize(TelemetryConfiguration configuration)
        {
            this.telemetryConfiguration = configuration ?? throw new ArgumentNullException(nameof(configuration));
            this.telemetryClient        = new TelemetryClient(configuration);
            this.telemetryClient.Context.GetInternalContext().SdkVersion = SdkVersionUtils.GetSdkVersion("web:");

            this.DisableTrackingProperties = configuration.EvaluateExperimentalFeature(Microsoft.ApplicationInsights.Common.Internal.ExperimentalConstants.DeferRequestTrackingProperties);
            if (this.DisableTrackingProperties)
            {
                configuration.DefaultTelemetrySink.TelemetryProcessorChainBuilder.Use(next => new PostSamplingTelemetryProcessor(next));
                configuration.DefaultTelemetrySink.TelemetryProcessorChainBuilder.Build();
            }

            // Headers will be read-only in a classic iis pipeline
            // Exception System.PlatformNotSupportedException: This operation requires IIS integrated pipeline mode.
            if (HttpRuntime.UsingIntegratedPipeline && this.EnableChildRequestTrackingSuppression)
            {
                this.childRequestTrackingSuppressionModule = new ChildRequestTrackingSuppressionModule(maxRequestsTracked: this.ChildRequestTrackingInternalDictionarySize);
            }
        }