@Override public Set<Object> getSingletons() { return new LinkedHashSet<>(asList(new Resource(), TracingApplicationEventListener.create( HttpTracing.create(Tracing.newBuilder().spanReporter(Reporter.NOOP).build()) ))); } }
public Unsampled() { super(TracingFilter.create( Tracing.newBuilder().sampler(Sampler.NEVER_SAMPLE).spanReporter(Reporter.NOOP).build() )); } }
public Traced128() { super(TracingFilter.create( Tracing.newBuilder().traceId128Bit(true).spanReporter(Reporter.NOOP).build())); } }
public Traced() { super(Tracing.newBuilder() .spanReporter(AsyncReporter.create(new NoopSender())) .build()); } }
@Override public Set<Object> getSingletons() { return new LinkedHashSet<>(asList(new Resource(), TracingApplicationEventListener.create( HttpTracing.create(Tracing.newBuilder() .sampler(Sampler.NEVER_SAMPLE) .spanReporter(Reporter.NOOP) .build()) ))); } }
@Override public Set<Object> getSingletons() { return new LinkedHashSet<>(asList(new Resource(), TracingApplicationEventListener.create( HttpTracing.create(Tracing.newBuilder() .traceId128Bit(true) .spanReporter(Reporter.NOOP) .build()) ))); } }
@Test public void newDecorator_shouldFailFastWhenRequestContextCurrentTraceContextNotConfigured() { assertThatThrownBy(() -> HttpTracingService.newDecorator(Tracing.newBuilder().build())) .isInstanceOf(IllegalStateException.class).hasMessage( "Tracing.currentTraceContext is not a RequestContextCurrentTraceContext scope. " + "Please call Tracing.Builder.currentTraceContext(RequestContextCurrentTraceContext.INSTANCE)." ); }
@Test public void newDecorator_shouldFailFastWhenRequestContextCurrentTraceContextNotConfigured() { assertThatThrownBy(() -> HttpTracingClient.newDecorator(Tracing.newBuilder().build())) .isInstanceOf(IllegalStateException.class).hasMessage( "Tracing.currentTraceContext is not a RequestContextCurrentTraceContext scope. " + "Please call Tracing.Builder.currentTraceContext(RequestContextCurrentTraceContext.INSTANCE)." ); }
public Unsampled() { super(Tracing.newBuilder() .sampler(Sampler.NEVER_SAMPLE) .spanReporter(AsyncReporter.create(new NoopSender())) .build()); } }
public Traced128() { super(Tracing.newBuilder() .traceId128Bit(true) .spanReporter(AsyncReporter.create(new NoopSender())) .build()); } }
public TracedExtra() { super(TracingFilter.create(Tracing.newBuilder() .propagationFactory(ExtraFieldPropagation.newFactoryBuilder(B3Propagation.FACTORY) .addField("x-vcap-request-id") .addPrefixedFields("baggage-", Arrays.asList("country-code", "user-id")) .build() ) .spanReporter(Reporter.NOOP) .build())); } }
public TracedExtra() { super(Tracing.newBuilder() .propagationFactory(ExtraFieldPropagation.newFactoryBuilder(B3Propagation.FACTORY) .addField("x-vcap-request-id") .addPrefixedFields("baggage-", Arrays.asList("country-code", "user-id")) .build() ) .spanReporter(AsyncReporter.create(new NoopSender())) .build()); } }
@Setup(Level.Trial) public void init() throws MessageNotWriteableException { Tracing tracing = Tracing.newBuilder().spanReporter(Reporter.NOOP).build(); producer = new FakeMessageProducer(); message.setText("value"); tracingProducer = TracingMessageProducer.create(producer, JmsTracing.create(tracing)); }
@Test public void newDecorator_shouldWorkWhenRequestContextCurrentTraceContextConfigured() { HttpTracingService.newDecorator( Tracing.newBuilder().currentTraceContext(RequestContextCurrentTraceContext.DEFAULT).build()); }
@Test public void newDecorator_shouldWorkWhenRequestContextCurrentTraceContextConfigured() { HttpTracingClient.newDecorator( Tracing.newBuilder().currentTraceContext(RequestContextCurrentTraceContext.DEFAULT).build()); }
@Setup(Level.Trial) public void init() { Tracing tracing = Tracing.newBuilder().spanReporter(Reporter.NOOP).build(); producer = new FakeProducer(); tracingProducer = KafkaTracing.create(tracing).producer(producer); tracingB3SingleProducer = KafkaTracing.newBuilder(tracing).writeB3SingleFormat(true).build().producer(producer); }
public TracedCorrelated() { super(Tracing.newBuilder() .currentTraceContext(ThreadLocalCurrentTraceContext.newBuilder() // intentionally added twice to test overhead of multiple correlations .addScopeDecorator(ThreadContextScopeDecorator.create()) .addScopeDecorator(ThreadContextScopeDecorator.create()) .build()) .spanReporter(AsyncReporter.create(new NoopSender())) .build()); } }
@Override public Tracer getTracer(StagemonitorPlugin.InitArguments initArguments) { final Tracing braveTracer = Tracing.newBuilder() .localServiceName(initArguments.getMeasurementSession().getApplicationName()) .reporter(getZipkinReporterBuilder(initArguments).build()) .sampler(getSampler()) .build(); return BraveTracer.newBuilder(braveTracer) .textMapPropagation(B3HeaderFormat.INSTANCE, Propagation.B3_STRING) .build(); }
@Test public void shouldNotSubmitSpanWhenNotSampled() throws Exception { final SpanCollectingReporter reporter = new SpanCollectingReporter(); final Tracing tracing = Tracing.newBuilder() .localServiceName(TEST_SERVICE) .spanReporter(reporter) .sampler(Sampler.create(0.0f)) .build(); testRemoteInvocation(tracing, null); assertThat(reporter.spans().poll(1, TimeUnit.SECONDS)).isNull(); }
private static Tracing newTracing(String name) { final CurrentTraceContext currentTraceContext = RequestContextCurrentTraceContext.newBuilder() .addScopeDecorator(StrictScopeDecorator.create()) .build(); return Tracing.newBuilder() .currentTraceContext(currentTraceContext) .localServiceName(name) .spanReporter(spanReporter) .sampler(Sampler.ALWAYS_SAMPLE) .build(); }