Ejemplo n.º 1
0
        public void Initialize()
        {
            Activity.DefaultIdFormat      = ActivityIdFormat.W3C;
            Activity.ForceDefaultIdFormat = true;

            ServicePointManager.DefaultConnectionLimit = 1000;
            this.sentTelemetry = new List <ITelemetry>();
            this.channel       = new StubTelemetryChannel
            {
                OnSend          = telemetry => this.sentTelemetry.Add(telemetry),
                EndpointAddress = FakeProfileApiEndpoint
            };

            this.appIdProvider.Defined = new Dictionary <string, string>
            {
                [IKey] = expectedAppId
            };

            this.config = new TelemetryConfiguration
            {
                InstrumentationKey    = IKey,
                TelemetryChannel      = this.channel,
                ApplicationIdProvider = this.appIdProvider
            };

            this.config.TelemetryInitializers.Add(new OperationCorrelationTelemetryInitializer());
            this.config.TelemetryInitializers.Add(this.operationDetailsInitializer);

            DependencyTableStore.IsDesktopHttpDiagnosticSourceActivated = false;
        }
        public void Initialize()
        {
            this.instrumentationKey = Guid.NewGuid().ToString();

            this.telemetryChannel = new StubTelemetryChannel()
            {
                EndpointAddress = "https://endpointaddress",
                OnSend          = this.sentTelemetry.Add
            };

            this.mockCorrelationIdLookupHelper = new MockCorrelationIdLookupHelper(new Dictionary <string, string>()
            {
                [this.instrumentationKey] = MockAppId
            });

            var configuration = new TelemetryConfiguration
            {
                TelemetryChannel   = this.telemetryChannel,
                InstrumentationKey = this.instrumentationKey,
            };

            configuration.TelemetryInitializers.Add(new OperationCorrelationTelemetryInitializer());
            this.listener = new HttpCoreDiagnosticSourceListener(
                configuration,
                this.telemetryChannel.EndpointAddress,
                setComponentCorrelationHttpHeaders: true,
                correlationDomainExclusionList: new string[] { "excluded.host.com" },
                correlationIdLookupHelper: this.mockCorrelationIdLookupHelper);
        }
        public void Initialize()
        {
            ServicePointManager.DefaultConnectionLimit = 1000;
            this.sentTelemetry = new List <DependencyTelemetry>();

            this.channel = new StubTelemetryChannel
            {
                OnSend = telemetry =>
                {
                    // The correlation id lookup service also makes http call, just make sure we skip that
                    DependencyTelemetry depTelemetry = telemetry as DependencyTelemetry;
                    if (depTelemetry != null)
                    {
                        this.sentTelemetry.Add(depTelemetry);
                    }
                },
                EndpointAddress = FakeProfileApiEndpoint
            };

            this.config = new TelemetryConfiguration
            {
                InstrumentationKey = IKey,
                TelemetryChannel   = this.channel
            };

            this.config.TelemetryInitializers.Add(new OperationCorrelationTelemetryInitializer());
            DependencyTableStore.IsDesktopHttpDiagnosticSourceActivated = false;
        }
Ejemplo n.º 4
0
        public void Initialize()
        {
            this.sentTelemetry   = new List <DependencyTelemetry>();
            this.request         = null;
            this.response        = null;
            this.responseHeaders = null;

            this.channel = new StubTelemetryChannel
            {
                OnSend = telemetry =>
                {
                    // The correlation id lookup service also makes http call, just make sure we skip that
                    DependencyTelemetry depTelemetry = telemetry as DependencyTelemetry;
                    if (depTelemetry != null)
                    {
                        this.sentTelemetry.Add(depTelemetry);
                        depTelemetry.TryGetOperationDetail(RemoteDependencyConstants.HttpRequestOperationDetailName, out this.request);
                        depTelemetry.TryGetOperationDetail(RemoteDependencyConstants.HttpResponseOperationDetailName, out this.response);
                        depTelemetry.TryGetOperationDetail(RemoteDependencyConstants.HttpResponseHeadersOperationDetailName, out this.responseHeaders);
                    }
                },
                EndpointAddress = FakeProfileApiEndpoint
            };

            this.config = new TelemetryConfiguration
            {
                InstrumentationKey = IKey,
                TelemetryChannel   = this.channel
            };

            this.config.TelemetryInitializers.Add(new OperationCorrelationTelemetryInitializer());
        }
Ejemplo n.º 5
0
        public void Initialize()
        {
            this.sentTelemetry = new List <DependencyTelemetry>();
            this.channel       = new StubTelemetryChannel
            {
                OnSend = telemetry =>
                {
                    // The correlation id lookup service also makes http call, just make sure we skip that
                    DependencyTelemetry depTelemetry = telemetry as DependencyTelemetry;
                    if (depTelemetry != null)
                    {
                        this.sentTelemetry.Add(depTelemetry);
                    }
                },
                EndpointAddress = FakeProfileApiEndpoint
            };

            this.appIdProvider.Defined = new Dictionary <string, string>
            {
                [IKey] = expectedAppId
            };

            this.config = new TelemetryConfiguration
            {
                InstrumentationKey    = IKey,
                TelemetryChannel      = this.channel,
                ApplicationIdProvider = this.appIdProvider
            };

            this.config.TelemetryInitializers.Add(new OperationCorrelationTelemetryInitializer());
            this.config.TelemetryInitializers.Add(this.operationDetailsInitializer);
        }
Ejemplo n.º 6
0
        public void Initialize()
        {
            this.sentTelemetry = new List <DependencyTelemetry>();

            this.channel = new StubTelemetryChannel
            {
                OnSend = telemetry =>
                {
                    // The correlation id lookup service also makes http call, just make sure we skip that
                    DependencyTelemetry depTelemetry = telemetry as DependencyTelemetry;
                    if (depTelemetry != null)
                    {
                        this.sentTelemetry.Add(depTelemetry);
                    }
                },
                EndpointAddress = FakeProfileApiEndpoint
            };

            this.config = new TelemetryConfiguration
            {
                InstrumentationKey = IKey,
                TelemetryChannel   = this.channel
            };

            this.config.TelemetryInitializers.Add(new OperationCorrelationTelemetryInitializer());
        }
Ejemplo n.º 7
0
        public void Initialize()
        {
            this.telemetryChannel = new StubTelemetryChannel
            {
                EndpointAddress = "https://endpointaddress",
                OnSend          = telemetry => this.sentTelemetry.Add(telemetry)
            };

            this.testInstrumentationKey1 = Guid.NewGuid().ToString();

            this.configuration = new TelemetryConfiguration
            {
                TelemetryChannel      = this.telemetryChannel,
                InstrumentationKey    = this.testInstrumentationKey1,
                ApplicationIdProvider = new MockApplicationIdProvider(this.testInstrumentationKey1, this.testApplicationId1)
            };

            this.configuration.TelemetryInitializers.Add(new OperationCorrelationTelemetryInitializer());
            this.configuration.TelemetryInitializers.Add(this.operationDetailsInitializer);

            this.listener = new HttpCoreDiagnosticSourceListener(
                this.configuration,
                setComponentCorrelationHttpHeaders: true,
                correlationDomainExclusionList: new string[] { "excluded.host.com" },
                injectLegacyHeaders: false,
                injectW3CHeaders: false);
        }
Ejemplo n.º 8
0
        public void TestInit()
        {
            this.sendItems            = new List <ITelemetry>();
            this.stubTelemetryChannel = new StubTelemetryChannel {
                OnSend = item => this.sendItems.Add(item)
            };

            this.configuration = new TelemetryConfiguration
            {
                InstrumentationKey = Guid.NewGuid().ToString(),
                TelemetryChannel   = stubTelemetryChannel
            };

            this.fakeSqlClientDiagnosticSource     = new FakeSqlClientDiagnosticSource();
            this.sqlClientDiagnosticSourceListener = new SqlClientDiagnosticSourceListener(configuration);
        }
Ejemplo n.º 9
0
        public void Initialize()
        {
            this.sentTelemetry   = new List <ITelemetry>();
            this.request         = null;
            this.response        = null;
            this.responseHeaders = null;

            this.telemetryChannel = new StubTelemetryChannel()
            {
                EndpointAddress = "https://endpointaddress",
                OnSend          = telemetry =>
                {
                    this.sentTelemetry.Add(telemetry);
                },
            };

            this.testInstrumentationKey1 = Guid.NewGuid().ToString();

            this.configuration = new TelemetryConfiguration
            {
                TelemetryChannel      = this.telemetryChannel,
                InstrumentationKey    = this.testInstrumentationKey1,
                ApplicationIdProvider = new MockApplicationIdProvider(this.testInstrumentationKey1, this.testApplicationId1)
            };

            this.configuration.TelemetryInitializers.Add(new OperationCorrelationTelemetryInitializer());
            this.configuration.TelemetryInitializers.Add(new StubTelemetryInitializer
            {
                OnInitialize = telemetry =>
                {
                    var depTelemetry = telemetry as DependencyTelemetry;
                    depTelemetry.TryGetOperationDetail(RemoteDependencyConstants.HttpRequestOperationDetailName, out this.request);
                    depTelemetry.TryGetOperationDetail(RemoteDependencyConstants.HttpResponseOperationDetailName, out this.response);
                    depTelemetry.TryGetOperationDetail(RemoteDependencyConstants.HttpResponseHeadersOperationDetailName, out this.responseHeaders);
                }
            });
            this.listener = new HttpCoreDiagnosticSourceListener(
                this.configuration,
                setComponentCorrelationHttpHeaders: true,
                correlationDomainExclusionList: new string[] { "excluded.host.com" },
                injectLegacyHeaders: false,
                injectW3CHeaders: false);
        }
Ejemplo n.º 10
0
        public void Initialize()
        {
            ServicePointManager.DefaultConnectionLimit = 1000;
            this.sentTelemetry   = new List <ITelemetry>();
            this.request         = null;
            this.response        = null;
            this.responseHeaders = null;

            this.channel = new StubTelemetryChannel
            {
                OnSend = telemetry =>
                {
                    this.sentTelemetry.Add(telemetry);
                },
                EndpointAddress = FakeProfileApiEndpoint
            };

            this.appIdProvider.Defined = new Dictionary <string, string>
            {
                [IKey] = expectedAppId
            };

            this.config = new TelemetryConfiguration
            {
                InstrumentationKey    = IKey,
                TelemetryChannel      = this.channel,
                ApplicationIdProvider = this.appIdProvider
            };

            this.config.TelemetryInitializers.Add(new OperationCorrelationTelemetryInitializer());
            this.config.TelemetryInitializers.Add(new StubTelemetryInitializer
            {
                OnInitialize = telemetry =>
                {
                    var depTelemetry = telemetry as DependencyTelemetry;
                    depTelemetry.TryGetOperationDetail(RemoteDependencyConstants.HttpRequestOperationDetailName, out this.request);
                    depTelemetry.TryGetOperationDetail(RemoteDependencyConstants.HttpResponseOperationDetailName, out this.response);
                    depTelemetry.TryGetOperationDetail(RemoteDependencyConstants.HttpResponseHeadersOperationDetailName, out this.responseHeaders);
                }
            });
            DependencyTableStore.IsDesktopHttpDiagnosticSourceActivated = false;
        }
Ejemplo n.º 11
0
        public void Initialize()
        {
            Activity.DefaultIdFormat      = ActivityIdFormat.W3C;
            Activity.ForceDefaultIdFormat = true;

            this.telemetryChannel = new StubTelemetryChannel
            {
                EndpointAddress = "https://endpointaddress",
                OnSend          = telemetry => this.sentTelemetry.Add(telemetry)
            };

            this.testInstrumentationKey1 = Guid.NewGuid().ToString();

            this.configuration = new TelemetryConfiguration
            {
                TelemetryChannel      = this.telemetryChannel,
                InstrumentationKey    = this.testInstrumentationKey1,
                ApplicationIdProvider = new MockApplicationIdProvider(this.testInstrumentationKey1, this.testApplicationId1)
            };

            this.configuration.TelemetryInitializers.Add(new OperationCorrelationTelemetryInitializer());
            this.configuration.TelemetryInitializers.Add(this.operationDetailsInitializer);
        }