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