public static TracerBuilder AddRequestCollector(this TracerBuilder builder, Action <AspNetCoreCollectorOptions> configure)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            var options = new AspNetCoreCollectorOptions();

            configure(options);

            return(builder.AddCollector(t => new AspNetCoreCollector(t, options)));
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AspNetCoreCollector"/> class.
 /// </summary>
 /// <param name="tracer">Tracer to record traced with.</param>
 /// <param name="options">Configuration options for ASP.NET Core collector.</param>
 public AspNetCoreCollector(Tracer tracer, AspNetCoreCollectorOptions options)
 {
     this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber(new HttpInListener("Microsoft.AspNetCore", tracer, options), null);
     this.diagnosticSourceSubscriber.Subscribe();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AspNetCoreCollector"/> class.
 /// </summary>
 /// <param name="options">Configuration options for dependencies collector.</param>
 /// <param name="tracer">Tracer to record traced with.</param>
 public AspNetCoreCollector(AspNetCoreCollectorOptions options, ITracer tracer)
 {
     this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber(new HttpInListener("Microsoft.AspNetCore", tracer), options.EventFilter);
     this.diagnosticSourceSubscriber.Subscribe();
 }