Java Code Examples for brave.propagation.CurrentTraceContext#Builder

The following examples show how to use brave.propagation.CurrentTraceContext#Builder . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CurrentTraceContextFactoryBean.java    From brave with Apache License 2.0 5 votes vote down vote up
@Override public CurrentTraceContext getObject() {
  CurrentTraceContext.Builder builder = ThreadLocalCurrentTraceContext.newBuilder();
  if (scopeDecorators != null) {
    for (ScopeDecorator scopeDecorator : scopeDecorators) {
      builder.addScopeDecorator(scopeDecorator);
    }
  }
  if (customizers != null) {
    for (CurrentTraceContextCustomizer customizer : customizers) customizer.customize(builder);
  }
  return builder.build();
}
 
Example 2
Source File: CurrentTraceContextTest.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override public void accept(CurrentTraceContext.Builder builder) {
  CurrentTraceContext current = builder.build();
  try (Scope ws = current.newScope(TraceContext.newBuilder().traceId(1L).spanId(2L).build())) {
  }
}
 
Example 3
Source File: ThreadContextScopeDecoratorTest.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override public CurrentTraceContext.Builder get() {
  return ThreadLocalCurrentTraceContext.newBuilder()
    .addScopeDecorator(ThreadContextScopeDecorator.newBuilder()
      .add(CORRELATION_FIELD).build());
}
 
Example 4
Source File: ThreadContextScopeDecoratorTest.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override protected Class<? extends Supplier<CurrentTraceContext.Builder>> builderSupplier() {
  return BuilderSupplier.class;
}
 
Example 5
Source File: ThreadContextCurrentTraceContextTest.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override public CurrentTraceContext.Builder get() {
  return new ThreadContextCurrentTraceContext.Builder(CurrentTraceContext.Default.create());
}
 
Example 6
Source File: ThreadContextCurrentTraceContextTest.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override protected Class<? extends Supplier<CurrentTraceContext.Builder>> builderSupplier() {
  return BuilderSupplier.class;
}
 
Example 7
Source File: MDCCurrentTraceContextTest.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override public CurrentTraceContext.Builder get() {
  return new MDCCurrentTraceContext.Builder(CurrentTraceContext.Default.create());
}
 
Example 8
Source File: MDCCurrentTraceContextTest.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override protected Class<? extends Supplier<CurrentTraceContext.Builder>> builderSupplier() {
  return BuilderSupplier.class;
}
 
Example 9
Source File: MDCScopeDecoratorTest.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override public CurrentTraceContext.Builder get() {
  return ThreadLocalCurrentTraceContext.newBuilder()
    .addScopeDecorator(MDCScopeDecorator.newBuilder().add(CORRELATION_FIELD).build());
}
 
Example 10
Source File: MDCScopeDecoratorTest.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override protected Class<? extends Supplier<CurrentTraceContext.Builder>> builderSupplier() {
  return BuilderSupplier.class;
}
 
Example 11
Source File: CurrentTraceContextTest.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override public void accept(CurrentTraceContext.Builder builder) {
  builder.build().newScope(TraceContext.newBuilder().traceId(1L).spanId(2L).build());
}
 
Example 12
Source File: MDCCurrentTraceContextTest.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override public CurrentTraceContext.Builder get() {
  return new MDCCurrentTraceContext.Builder(CurrentTraceContext.Default.inheritable());
}
 
Example 13
Source File: CurrentTraceContextTest.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override public void accept(CurrentTraceContext.Builder builder) {
  builder.build();
}
 
Example 14
Source File: MDCScopeDecoratorTest.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override public CurrentTraceContext.Builder get() {
  return ThreadLocalCurrentTraceContext.newBuilder()
    .addScopeDecorator(MDCScopeDecorator.newBuilder().add(CORRELATION_FIELD).build());
}
 
Example 15
Source File: ITRemote.java    From brave with Apache License 2.0 4 votes vote down vote up
/** Subclass to override the builder. The result will have {@link StrictScopeDecorator} added */
protected CurrentTraceContext.Builder currentTraceContextBuilder() {
  return StrictCurrentTraceContext.newBuilder();
}
 
Example 16
Source File: BraveServiceIntegrationTest.java    From armeria with Apache License 2.0 4 votes vote down vote up
@Override
protected CurrentTraceContext.Builder currentTraceContextBuilder() {
    return RequestContextCurrentTraceContext.builder();
}
 
Example 17
Source File: BraveClientIntegrationTest.java    From armeria with Apache License 2.0 4 votes vote down vote up
@Override
protected CurrentTraceContext.Builder currentTraceContextBuilder() {
    return RequestContextCurrentTraceContext.builder();
}
 
Example 18
Source File: RequestContextCurrentTraceContext.java    From armeria with Apache License 2.0 4 votes vote down vote up
RequestContextCurrentTraceContext(
        CurrentTraceContext.Builder builder, List<Pattern> nonRequestThreadPatterns) {
    super(builder);

    this.nonRequestThreadPatterns = nonRequestThreadPatterns;
}
 
Example 19
Source File: TraceAutoConfiguration.java    From spring-cloud-sleuth with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean
CurrentTraceContext.Builder sleuthCurrentTraceContextBuilder() {
	return ThreadLocalCurrentTraceContext.newBuilder();
}
 
Example 20
Source File: CurrentTraceContextTest.java    From brave with Apache License 2.0 votes vote down vote up
protected abstract Class<? extends Supplier<CurrentTraceContext.Builder>> builderSupplier();