public Tracer.Builder GetTracerBuilder()
        {
            if (ReporterConfig == null)
            {
                ReporterConfig = new ReporterConfiguration(_loggerFactory);
            }
            if (SamplerConfig == null)
            {
                SamplerConfig = new SamplerConfiguration(_loggerFactory);
            }
            if (_codecConfig == null)
            {
                _codecConfig = new CodecConfiguration(new Dictionary <IFormat <ITextMap>, List <Codec <ITextMap> > >());
            }
            if (_metricsFactory == null)
            {
                _metricsFactory = NoopMetricsFactory.Instance;
            }
            IMetrics  metrics  = new MetricsImpl(_metricsFactory);
            IReporter reporter = ReporterConfig.GetReporter(metrics);
            ISampler  sampler  = SamplerConfig.CreateSampler(_serviceName, metrics);

            Tracer.Builder builder = new Tracer.Builder(_serviceName)
                                     .WithLoggerFactory(_loggerFactory)
                                     .WithSampler(sampler)
                                     .WithReporter(reporter)
                                     .WithMetrics(metrics)
                                     .WithTags(_tracerTags);

            _codecConfig.Apply(builder);

            return(builder);
        }
        public void TestAddTagsToMetricName()
        {
            var tags = new Dictionary <string, string>();

            tags["foo"] = "bar";
            Assert.Equal("thecounter.foo=bar", MetricsImpl.AddTagsToMetricName("thecounter", tags));
            Assert.Equal("jaeger:thecounter.foo=bar", MetricsImpl.AddTagsToMetricName("jaeger:thecounter", tags));
        }
Example #3
0
 public RemoteControlledSampler Build()
 {
     if (LoggerFactory == null)
     {
         LoggerFactory = NullLoggerFactory.Instance;
     }
     if (InitialSampler == null)
     {
         InitialSampler = new ProbabilisticSampler();
     }
     if (Metrics == null)
     {
         Metrics = new MetricsImpl(NoopMetricsFactory.Instance);
     }
     return(new RemoteControlledSampler(this));
 }
        public EndToEndBehavior(string samplingHostPort, string serviceName, ISender sender)
        {
            IMetrics  metrics  = new MetricsImpl(NoopMetricsFactory.Instance);
            IReporter reporter = new RemoteReporter.Builder()
                                 .WithSender(sender)
                                 .WithFlushInterval(TimeSpan.FromSeconds(1))
                                 .WithMaxQueueSize(100)
                                 .WithMetrics(metrics)
                                 .Build();

            var constSampler = new ConstSampler(true);

            _tracers = new Dictionary <string, ITracer>
            {
                { RemoteControlledSampler.Type, GetRemoteTracer(metrics, reporter, serviceName, samplingHostPort) },
                { ConstSampler.Type, new Tracer.Builder(serviceName).WithReporter(reporter).WithSampler(constSampler).Build() }
            };
        }
        public Tracer.Builder GetTracerBuilder()
        {
            if (ReporterConfig == null)
            {
                ReporterConfig = new ReporterConfiguration(_loggerFactory);
            }
            if (SamplerConfig == null)
            {
                SamplerConfig = new SamplerConfiguration(_loggerFactory);
            }
            if (CodecConfig == null)
            {
                CodecConfig = new CodecConfiguration(_loggerFactory);
            }
            if (_metricsFactory == null)
            {
                _metricsFactory = NoopMetricsFactory.Instance;
            }
            IMetrics  metrics  = new MetricsImpl(_metricsFactory);
            IReporter reporter = ReporterConfig.GetReporter(metrics);
            ISampler  sampler  = SamplerConfig.GetSampler(ServiceName, metrics);

            Tracer.Builder builder = new Tracer.Builder(ServiceName)
                                     .WithLoggerFactory(_loggerFactory)
                                     .WithSampler(sampler)
                                     .WithReporter(reporter)
                                     .WithMetrics(metrics)
                                     .WithTags(_tracerTags);

            if (UseTraceId128Bit)
            {
                builder = builder.WithTraceId128Bit();
            }

            CodecConfig.Apply(builder);

            return(builder);
        }
Example #6
0
            public Tracer Build()
            {
                if (LoggerFactory == null)
                {
                    LoggerFactory = NullLoggerFactory.Instance;
                }

                _registry = new PropagationRegistry(LoggerFactory);
                foreach (var configureRegistry in _registryActions)
                {
                    configureRegistry(_registry);
                }

                if (Metrics == null)
                {
                    Metrics = new MetricsImpl(NoopMetricsFactory.Instance);
                }

                if (Reporter == null)
                {
                    Reporter = new RemoteReporter.Builder()
                               .WithLoggerFactory(LoggerFactory)
                               .WithMetrics(Metrics)
                               .Build();
                }
                if (Sampler == null)
                {
                    Sampler = new RemoteControlledSampler.Builder(ServiceName)
                              .WithLoggerFactory(LoggerFactory)
                              .WithMetrics(Metrics)
                              .Build();
                }

                return(new Tracer(ServiceName, Reporter, Sampler, _registry, Clock, Metrics, LoggerFactory,
                                  _tags, ZipkinSharedRpcSpan, ScopeManager, BaggageRestrictionManager, ExpandExceptionLogs, UseTraceId128Bit));
            }
Example #7
0
 public Builder WithMetricsFactory(IMetricsFactory factory)
 {
     Metrics = new MetricsImpl(factory);
     return(this);
 }