public HttpCoreDiagnosticSourceListener(
            TelemetryConfiguration configuration,
            bool setComponentCorrelationHttpHeaders,
            IEnumerable <string> correlationDomainExclusionList,
            bool injectLegacyHeaders,
            bool injectW3CHeaders)
        {
            this.client = new TelemetryClient(configuration);
            this.client.Context.GetInternalContext().SdkVersion = SdkVersionUtils.GetSdkVersion("rdd" + RddSource.DiagnosticSourceCore + ":");

            var httpClientVersion = typeof(HttpClient).GetTypeInfo().Assembly.GetName().Version;

            this.isNetCore20HttpClient = httpClientVersion.CompareTo(new Version(4, 2)) >= 0;

            this.configuration = configuration;
            this.applicationInsightsUrlFilter       = new ApplicationInsightsUrlFilter(configuration);
            this.setComponentCorrelationHttpHeaders = setComponentCorrelationHttpHeaders;
            this.correlationDomainExclusionList     = correlationDomainExclusionList ?? Enumerable.Empty <string>();
            this.injectLegacyHeaders = injectLegacyHeaders;
            this.injectW3CHeaders    = injectW3CHeaders;

            this.subscriber = new HttpCoreDiagnosticSourceSubscriber(
                this,
                this.applicationInsightsUrlFilter,
                this.isNetCore20HttpClient);
        }
示例#2
0
        public HttpCoreDiagnosticSourceListener(
            TelemetryConfiguration configuration,
            bool setComponentCorrelationHttpHeaders,
            IEnumerable <string> correlationDomainExclusionList,
            bool injectLegacyHeaders,
            bool injectRequestIdInW3CMode,
            HttpInstrumentationVersion instrumentationVersion)
        {
            this.client = new TelemetryClient(configuration);
            this.client.Context.GetInternalContext().SdkVersion = SdkVersionUtils.GetSdkVersion("rdd" + RddSource.DiagnosticSourceCore + ":");

            this.configuration = configuration;
            this.applicationInsightsUrlFilter       = new ApplicationInsightsUrlFilter(configuration);
            this.setComponentCorrelationHttpHeaders = setComponentCorrelationHttpHeaders;
            this.correlationDomainExclusionList     = correlationDomainExclusionList ?? Enumerable.Empty <string>();
            this.injectLegacyHeaders        = injectLegacyHeaders;
            this.httpInstrumentationVersion = instrumentationVersion != HttpInstrumentationVersion.Unknown ?
                                              instrumentationVersion :
                                              this.GetInstrumentationVersion();
            this.injectRequestIdInW3CMode = injectRequestIdInW3CMode;
            this.subscriber = new HttpCoreDiagnosticSourceSubscriber(
                this,
                this.applicationInsightsUrlFilter,
                this.httpInstrumentationVersion);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ProfilerHttpProcessing"/> class.
        /// </summary>
        public ProfilerHttpProcessing(TelemetryConfiguration configuration, string agentVersion, ObjectInstanceBasedOperationHolder telemetryTupleHolder, bool setCorrelationHeaders, ICollection<string> correlationDomainExclusionList)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            if (telemetryTupleHolder == null)
            {
                throw new ArgumentNullException("telemetryTupleHolder");
            }

            if (correlationDomainExclusionList == null)
            {
                throw new ArgumentNullException("correlationDomainExclusionList");
            }

            this.applicationInsightsUrlFilter = new ApplicationInsightsUrlFilter(configuration);
            this.TelemetryTable = telemetryTupleHolder;
            this.telemetryClient = new TelemetryClient(configuration);
            this.correlationDomainExclusionList = correlationDomainExclusionList;
            this.setCorrelationHeaders = setCorrelationHeaders;

            // Since dependencySource is no longer set, sdk version is prepended with information which can identify whether RDD was collected by profiler/framework
            // For directly using TrackDependency(), version will be simply what is set by core
            string prefix = "rdd" + RddSource.Profiler + ":";
            this.telemetryClient.Context.GetInternalContext().SdkVersion = SdkVersionUtils.GetSdkVersion(prefix);
            if (!string.IsNullOrEmpty(agentVersion))
            {
                this.telemetryClient.Context.GetInternalContext().AgentVersion = agentVersion;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ProfilerHttpProcessing"/> class.
        /// </summary>
        public ProfilerHttpProcessing(TelemetryConfiguration configuration, string agentVersion, ObjectInstanceBasedOperationHolder telemetryTupleHolder, bool setCorrelationHeaders, ICollection <string> correlationDomainExclusionList)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            if (telemetryTupleHolder == null)
            {
                throw new ArgumentNullException("telemetryTupleHolder");
            }

            if (correlationDomainExclusionList == null)
            {
                throw new ArgumentNullException("correlationDomainExclusionList");
            }

            this.applicationInsightsUrlFilter = new ApplicationInsightsUrlFilter(configuration);
            this.TelemetryTable  = telemetryTupleHolder;
            this.telemetryClient = new TelemetryClient(configuration);
            this.correlationDomainExclusionList = correlationDomainExclusionList;
            this.setCorrelationHeaders          = setCorrelationHeaders;

            // Since dependencySource is no longer set, sdk version is prepended with information which can identify whether RDD was collected by profiler/framework
            // For directly using TrackDependency(), version will be simply what is set by core
            string prefix = "rdd" + RddSource.Profiler + ":";

            this.telemetryClient.Context.GetInternalContext().SdkVersion = SdkVersionUtils.GetSdkVersion(prefix);
            if (!string.IsNullOrEmpty(agentVersion))
            {
                this.telemetryClient.Context.GetInternalContext().AgentVersion = agentVersion;
            }
        }
示例#5
0
 public void IsApplicationInsightsUrlReturnsTrueForTelemetryChannelEndpointAddress()
 {
     using (TelemetryConfiguration configuration = this.CreateStubTelemetryConfiguration())
     {
         string url = "https://endpointaddress";
         ApplicationInsightsUrlFilter urlFilter = new ApplicationInsightsUrlFilter(configuration);
         Assert.IsTrue(urlFilter.IsApplicationInsightsUrl(url));
     }
 }
示例#6
0
 public void IsApplicationInsightsUrlReturnsTrueForQuickPulseServiceEndpoint()
 {
     using (TelemetryConfiguration configuration = this.CreateStubTelemetryConfiguration())
     {
         string url = "https://rt.services.visualstudio.com/QuickPulseService.svc";
         ApplicationInsightsUrlFilter urlFilter = new ApplicationInsightsUrlFilter(configuration);
         Assert.IsTrue(urlFilter.IsApplicationInsightsUrl(url));
     }
 }
 public void IsApplicationInsightsUrlReturnsTrueForTelemetryChannelEndpointAddress()
 {
     using (TelemetryConfiguration configuration = this.CreateStubTelemetryConfiguration())
     {    
         string url = "https://endpointaddress";
         ApplicationInsightsUrlFilter urlFilter = new ApplicationInsightsUrlFilter(configuration);
         Assert.IsTrue(urlFilter.IsApplicationInsightsUrl(url));
     }
 }
 public void IsApplicationInsightsUrlReturnsTrueForTelemetryServiceEndpoint()
 {
     using (TelemetryConfiguration configuration = this.CreateStubTelemetryConfiguration())
     {               
         string url = "https://dc.services.visualstudio.com/v2/track";
         ApplicationInsightsUrlFilter urlFilter = new ApplicationInsightsUrlFilter(configuration);
         Assert.IsTrue(urlFilter.IsApplicationInsightsUrl(url));
     }
 }
示例#9
0
 public void IsApplicationInsightsUrlReturnsFalseForNullOrEmptyUrl()
 {
     using (TelemetryConfiguration configuration = this.CreateStubTelemetryConfiguration())
     {
         string url = null;
         ApplicationInsightsUrlFilter urlFilter = new ApplicationInsightsUrlFilter(configuration);
         Assert.IsFalse(urlFilter.IsApplicationInsightsUrl(url));
         url = string.Empty;
         Assert.IsFalse(urlFilter.IsApplicationInsightsUrl(url));
     }
 }
示例#10
0
        internal FrameworkHttpProcessing(TelemetryConfiguration configuration, CacheBasedOperationHolder telemetryTupleHolder, bool setCorrelationHeaders, ICollection <string> correlationDomainExclusionList, bool injectLegacyHeaders)
            : base(configuration, SdkVersionUtils.GetSdkVersion("rdd" + RddSource.Framework + ":"), null, setCorrelationHeaders, correlationDomainExclusionList, injectLegacyHeaders, false)
        {
            if (telemetryTupleHolder == null)
            {
                throw new ArgumentNullException("telemetryTupleHolder");
            }

            this.applicationInsightsUrlFilter = new ApplicationInsightsUrlFilter(configuration);
            this.TelemetryTable = telemetryTupleHolder;
        }
 public void IsApplicationInsightsUrlReturnsFalseForNullOrEmptyUrl()
 {
     using (TelemetryConfiguration configuration = this.CreateStubTelemetryConfiguration())
     {
         string url = null;
         ApplicationInsightsUrlFilter urlFilter = new ApplicationInsightsUrlFilter(configuration);
         Assert.IsFalse(urlFilter.IsApplicationInsightsUrl(url));
         url = string.Empty;
         Assert.IsFalse(urlFilter.IsApplicationInsightsUrl(url));
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="HttpProcessing"/> class.
        /// </summary>
        public HttpProcessing(TelemetryConfiguration configuration, string sdkVersion, string agentVersion, bool setCorrelationHeaders, ICollection <string> correlationDomainExclusionList)
        {
            this.configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
            this.applicationInsightsUrlFilter = new ApplicationInsightsUrlFilter(configuration);
            this.telemetryClient = new TelemetryClient(configuration);

            this.correlationDomainExclusionList = correlationDomainExclusionList ?? throw new ArgumentNullException(nameof(correlationDomainExclusionList));
            this.setCorrelationHeaders          = setCorrelationHeaders;

            this.telemetryClient.Context.GetInternalContext().SdkVersion = sdkVersion;
            if (!string.IsNullOrEmpty(agentVersion))
            {
                this.telemetryClient.Context.GetInternalContext().AgentVersion = agentVersion;
            }
        }
示例#13
0
 internal HttpDesktopDiagnosticSourceSubscriber(
     HttpDesktopDiagnosticSourceListener parent,
     ApplicationInsightsUrlFilter applicationInsightsUrlFilter)
 {
     this.parent = parent;
     this.applicationInsightsUrlFilter = applicationInsightsUrlFilter;
     try
     {
         this.allListenersSubscription = DiagnosticListener.AllListeners.Subscribe(this);
     }
     catch (Exception ex)
     {
         DependencyCollectorEventSource.Log.HttpDesktopDiagnosticSubscriberFailedToSubscribe(ex.ToInvariantString());
     }
 }
        public HttpCoreDiagnosticSourceListener(
            TelemetryConfiguration configuration,
            string effectiveProfileQueryEndpoint,
            bool setComponentCorrelationHttpHeaders,
            IEnumerable <string> correlationDomainExclusionList,
            ICorrelationIdLookupHelper correlationIdLookupHelper)
        {
            this.client = new TelemetryClient(configuration);
            this.client.Context.GetInternalContext().SdkVersion = SdkVersionUtils.GetSdkVersion("rdd" + RddSource.DiagnosticSourceCore + ":");

            this.configuration = configuration;
            this.applicationInsightsUrlFilter       = new ApplicationInsightsUrlFilter(configuration);
            this.setComponentCorrelationHttpHeaders = setComponentCorrelationHttpHeaders;
            this.correlationIdLookupHelper          = correlationIdLookupHelper ?? new CorrelationIdLookupHelper(effectiveProfileQueryEndpoint);
            this.correlationDomainExclusionList     = correlationDomainExclusionList ?? Enumerable.Empty <string>();

            this.subscriber = new HttpCoreDiagnosticSourceSubscriber(this, this.applicationInsightsUrlFilter);
        }
            internal HttpCoreDiagnosticSourceSubscriber(HttpCoreDiagnosticSourceListener listener, ApplicationInsightsUrlFilter applicationInsightsUrlFilter)
            {
                this.httpDiagnosticListener       = listener;
                this.applicationInsightsUrlFilter = applicationInsightsUrlFilter;

                var httpClientVersion = typeof(HttpClient).GetTypeInfo().Assembly.GetName().Version;

                this.isNetCore20HttpClient = httpClientVersion.CompareTo(new Version(4, 2)) >= 0;

                try
                {
                    this.listenerSubscription = DiagnosticListener.AllListeners.Subscribe(this);
                }
                catch (Exception ex)
                {
                    DependencyCollectorEventSource.Log.HttpCoreDiagnosticSubscriberFailedToSubscribe(ex.ToInvariantString());
                }
            }
示例#16
0
            internal HttpCoreDiagnosticSourceSubscriber(
                HttpCoreDiagnosticSourceListener listener,
                ApplicationInsightsUrlFilter applicationInsightsUrlFilter,
                bool isNetCore20HttpClient)
            {
                this.httpDiagnosticListener       = listener;
                this.applicationInsightsUrlFilter = applicationInsightsUrlFilter;

                this.isNetCore20HttpClient = isNetCore20HttpClient;

                try
                {
                    this.listenerSubscription = DiagnosticListener.AllListeners.Subscribe(this);
                }
                catch (Exception ex)
                {
                    DependencyCollectorEventSource.Log.HttpCoreDiagnosticSubscriberFailedToSubscribe(ex.ToInvariantString());
                }
            }
        internal FrameworkHttpProcessing(TelemetryConfiguration configuration, CacheBasedOperationHolder telemetryTupleHolder)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            if (telemetryTupleHolder == null)
            {
                throw new ArgumentNullException("telemetryTupleHolder");
            }

            this.applicationInsightsUrlFilter = new ApplicationInsightsUrlFilter(configuration);
            this.TelemetryTable = telemetryTupleHolder;
            this.telemetryClient = new TelemetryClient(configuration);

            // Since dependencySource is no longer set, sdk version is prepended with information which can identify whether RDD was collected by profiler/framework

            // For directly using TrackDependency(), version will be simply what is set by core
            this.telemetryClient.Context.GetInternalContext().SdkVersion = string.Format(CultureInfo.InvariantCulture, "rdd{0}: {1}", RddSource.Framework, SdkVersionUtils.GetAssemblyVersion());
        }
示例#18
0
            internal HttpCoreDiagnosticSourceSubscriber(
                HttpCoreDiagnosticSourceListener listener,
                ApplicationInsightsUrlFilter applicationInsightsUrlFilter,
                HttpInstrumentationVersion httpInstrumentationVersion)
            {
                this.httpDiagnosticListener       = listener;
                this.applicationInsightsUrlFilter = applicationInsightsUrlFilter;

                this.httpInstrumentationVersion = httpInstrumentationVersion;

                try
                {
                    this.listenerSubscription = DiagnosticListener.AllListeners.Subscribe(this);
                }
                catch (Exception ex)
                {
                    DependencyCollectorEventSource.Log.HttpCoreDiagnosticSubscriberFailedToSubscribe(ex.ToInvariantString());
                }

                SubscriptionManager.Attach(this.httpDiagnosticListener);
            }
        internal FrameworkHttpProcessing(TelemetryConfiguration configuration, CacheBasedOperationHolder telemetryTupleHolder)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            if (telemetryTupleHolder == null)
            {
                throw new ArgumentNullException("telemetryTupleHolder");
            }

            this.applicationInsightsUrlFilter = new ApplicationInsightsUrlFilter(configuration);
            this.TelemetryTable  = telemetryTupleHolder;
            this.telemetryClient = new TelemetryClient(configuration);

            // Since dependencySource is no longer set, sdk version is prepended with information which can identify whether RDD was collected by profiler/framework

            // For directly using TrackDependency(), version will be simply what is set by core
            this.telemetryClient.Context.GetInternalContext().SdkVersion = string.Format(CultureInfo.InvariantCulture, "rdd{0}: {1}", RddSource.Framework, SdkVersionUtils.GetAssemblyVersion());
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="HttpProcessing"/> class.
        /// </summary>
        public HttpProcessing(TelemetryConfiguration configuration, string sdkVersion, string agentVersion, bool setCorrelationHeaders, ICollection <string> correlationDomainExclusionList, string appIdEndpoint)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            if (correlationDomainExclusionList == null)
            {
                throw new ArgumentNullException("correlationDomainExclusionList");
            }

            this.applicationInsightsUrlFilter = new ApplicationInsightsUrlFilter(configuration);
            this.telemetryClient = new TelemetryClient(configuration);
            this.correlationDomainExclusionList = correlationDomainExclusionList;
            this.setCorrelationHeaders          = setCorrelationHeaders;
            this.correlationIdLookupHelper      = new CorrelationIdLookupHelper(appIdEndpoint);

            this.telemetryClient.Context.GetInternalContext().SdkVersion = sdkVersion;
            if (!string.IsNullOrEmpty(agentVersion))
            {
                this.telemetryClient.Context.GetInternalContext().AgentVersion = agentVersion;
            }
        }
示例#21
0
 internal HttpDesktopDiagnosticSourceListener(DesktopDiagnosticSourceHttpProcessing httpProcessing, ApplicationInsightsUrlFilter applicationInsightsUrlFilter)
 {
     this.httpDesktopProcessing       = httpProcessing;
     this.subscribeHelper             = new HttpDesktopDiagnosticSourceSubscriber(this, applicationInsightsUrlFilter);
     this.requestFetcherRequestEvent  = new PropertyFetcher("Request");
     this.requestFetcherResponseEvent = new PropertyFetcher("Request");
     this.responseFetcher             = new PropertyFetcher("Response");
 }