public static ITracer GetTracer(string serviceName, ILoggerFactory loggerFactory, ISampler sampler, IReporter reporter) { var tracer = new Tracer.Builder(serviceName); if (!loggerFactory.IsNull()) { tracer.WithLoggerFactory(loggerFactory); } if (!sampler.IsNull()) { tracer.WithSampler(sampler); } if (!reporter.IsNull()) { tracer.WithReporter(reporter); } return(tracer.Build()); }
public static IServiceCollection AddJaeger(this IServiceCollection services, string name) { services.AddSingleton <ITracer>(sp => { var loggerFactory = sp.GetRequiredService <ILoggerFactory>(); //var reporter = new RemoteReporter(); var sampler = new ConstSampler(true); var tracerBuilder = new Tracer.Builder(name) //.WithReporter() .WithSampler(sampler); var tracer = tracerBuilder.Build(); //GlobalTracer.Register(tracer); return(tracer); }); return(services); }
public void Builder_ShouldUseOpenTracingScopeManagerWhenScopeManagerIsNull() { Assert.True(_baseBuilder.Build().ScopeManager is AsyncLocalScopeManager); }