Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
            // Регистрируем middleware
            services.AddOpenTracing();

            // Добавляем LightStep Tracer.
            services.AddSingleton <ITracer>(serviceProvider =>
            {
                var tracerOptions = new LightStep.Options();
                var tracer        = new Tracer(tracerOptions);
                GlobalTracer.Register(tracer);

                return(tracer);
            });
        }
        public static IServiceCollection AddLightStep(this IServiceCollection services)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            services.AddSingleton <ITracer>(serviceProvider =>
            {
                string serviceName           = Assembly.GetEntryAssembly().GetName().Name;
                ILoggerFactory loggerFactory = serviceProvider.GetRequiredService <ILoggerFactory>();

                var options = new LightStep.Options(_lightStepProjectKey, new SatelliteOptions("collector.lightstep.com"));

                ITracer tracer = new LightStep.Tracer(options);

                GlobalTracer.Register(tracer);

                return(tracer);
            });

            return(services);
        }
Exemplo n.º 3
0
 /// <inheritdoc />
 public Tracer(Options options, ISpanRecorder spanRecorder, IReportTranslator translator,
               ILightStepHttpClient client) : this(
         new AsyncLocalScopeManager(), Propagators.TextMap, options, spanRecorder, client, translator)
 {
 }
Exemplo n.º 4
0
 /// <inheritdoc />
 public Tracer(Options options, IPropagator propagator, ILightStepHttpClient client) : this(
         new AsyncLocalScopeManager(), propagator, options, new LightStepSpanRecorder(), client)
 {
 }
Exemplo n.º 5
0
 /// <inheritdoc />
 public Tracer(Options options, ISpanRecorder spanRecorder, IPropagator propagator) : this(
         new AsyncLocalScopeManager(), propagator, options, spanRecorder, null)
 {
 }
Exemplo n.º 6
0
 /// <inheritdoc />
 public Tracer(Options options, IScopeManager scopeManager) : this(scopeManager, Propagators.TextMap, options,
                                                                   new LightStepSpanRecorder(), null)
 {
 }
Exemplo n.º 7
0
 /// <inheritdoc />
 public Tracer(Options options, ISpanRecorder spanRecorder) : this(new AsyncLocalScopeManager(),
                                                                   Propagators.TextMap, options, spanRecorder, null)
 {
 }
Exemplo n.º 8
0
 /// <inheritdoc />
 public Tracer(Options options) : this(new AsyncLocalScopeManager(), Propagators.TextMap, options,
                                       new LightStepSpanRecorder(), null)
 {
 }