/// <summary>
        /// Initializes a new instance of the <see cref="RequestsCollector"/> class.
        /// </summary>
        /// <param name="options">Configuration options for dependencies collector.</param>
        /// <param name="tracer">Tracer to record traced with.</param>
        /// <param name="sampler">Sampler to use to sample dependency calls.</param>
        /// <param name="propagationComponent">Wire context propagation component.</param>
        public RequestsCollector(RequestsCollectorOptions options, ITracer tracer, ISampler sampler, IPropagationComponent propagationComponent)
        {
            this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber(
                new Dictionary <string, Func <ITracer, Func <HttpRequest, ISampler>, ListenerHandler> >()
            {
                { "Microsoft.AspNetCore", (t, s) => new HttpInListener(t, s, propagationComponent) },
            },
                tracer,
                x =>
            {
                ISampler s = null;
                try
                {
                    s = options.CustomSampler(x);
                }
                catch (Exception e)
                {
                    s = null;
                    AspNetCoreCollectorEventSource.Log.ExceptionInCustomSampler(e);
                }

                return(s == null ? sampler : s);
            });
            this.diagnosticSourceSubscriber.Subscribe();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DependenciesCollector"/> class.
        /// </summary>
        /// <param name="options">Configuration options for dependencies collector.</param>
        /// <param name="tracer">Tracer to record traced with.</param>
        /// <param name="sampler">Sampler to use to sample dependnecy calls.</param>
        /// <param name="propagationComponent">Propagation component to use to encode span context to the wire.</param>
        public DependenciesCollector(DependenciesCollectorOptions options, ITracer tracer, ISampler sampler, IPropagationComponent propagationComponent)
        {
            this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber(
                new Dictionary <string, Func <ITracer, Func <HttpRequestMessage, ISampler>, ListenerHandler> >()
            {
                { "HttpHandlerDiagnosticListener", (t, s) => new HttpHandlerDiagnosticListener(t, s, propagationComponent) }
            },
                tracer,
                x =>
            {
                ISampler s = null;
                try
                {
                    s = options.CustomSampler(x);
                }
                catch (Exception e)
                {
                    s = null;
                    DependenciesCollectorEventSource.Log.ExceptionInCustomSampler(e);
                }

                return(s == null ? sampler : s);
            });
            this.diagnosticSourceSubscriber.Subscribe();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RequestsCollector"/> class.
 /// </summary>
 /// <param name="options">Configuration options for dependencies collector.</param>
 /// <param name="tracer">Tracer to record traced with.</param>
 /// <param name="sampler">Sampler to use to sample dependency calls.</param>
 /// <param name="propagationComponent">Wire context propagation component.</param>
 public RequestsCollector(RequestsCollectorOptions options, ITracer tracer, ISampler sampler, IPropagationComponent propagationComponent)
 {
     this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber(
         new Dictionary <string, Func <ITracer, ISampler, ListenerHandler> >()
     {
         { "Microsoft.AspNetCore", (t, s) => new HttpInListener(t, s, propagationComponent) },
     },
         tracer,
         sampler);
     this.diagnosticSourceSubscriber.Subscribe();
 }
예제 #4
0
 public HttpHandlerDiagnosticListener(ITracer tracer, ISampler sampler, IPropagationComponent propagationComponent)
     : base("HttpHandlerDiagnosticListener", tracer, sampler)
 {
     this.propagationComponent = propagationComponent;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DependenciesCollector"/> class.
 /// </summary>
 /// <param name="options">Configuration options for dependencies collector.</param>
 /// <param name="tracer">Tracer to record traced with.</param>
 /// <param name="sampler">Sampler to use to sample dependnecy calls.</param>
 /// <param name="propagationComponent">Propagation component to use to encode span context to the wire.</param>
 public DependenciesCollector(DependenciesCollectorOptions options, ITracer tracer, ISampler sampler, IPropagationComponent propagationComponent)
 {
     this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber(
         new Dictionary <string, Func <ITracer, ISampler, ListenerHandler> >()
     {
         { "HttpHandlerDiagnosticListener", (t, s) => new HttpHandlerDiagnosticListener(t, s, propagationComponent) }
     },
         tracer,
         sampler);
     this.diagnosticSourceSubscriber.Subscribe();
 }
 public HttpInListener(ITracer tracer, ISampler sampler, IPropagationComponent propagationComponent)
     : base("Microsoft.AspNetCore", tracer, sampler)
 {
     this.propagationComponent = propagationComponent;
 }
 public HttpHandlerDiagnosticListener(ITracer tracer, Func <HttpRequestMessage, ISampler> samplerFactory, IPropagationComponent propagationComponent)
     : base("HttpHandlerDiagnosticListener", tracer, samplerFactory)
 {
     this.propagationComponent = propagationComponent;
 }
예제 #8
0
 public HttpInListener(ITracer tracer, Func <HttpRequest, ISampler> samplerFactory, IPropagationComponent propagationComponent)
     : base("Microsoft.AspNetCore", tracer, samplerFactory)
 {
     this.propagationComponent = propagationComponent;
 }