Java Code Examples for brave.propagation.CurrentTraceContext#ScopeDecorator

The following examples show how to use brave.propagation.CurrentTraceContext#ScopeDecorator . 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: TraceAutoConfiguration.java    From spring-cloud-sleuth with Apache License 2.0 6 votes vote down vote up
@Bean
CurrentTraceContext sleuthCurrentTraceContext(CurrentTraceContext.Builder builder,
		@Nullable List<CurrentTraceContext.ScopeDecorator> scopeDecorators,
		@Nullable List<CurrentTraceContextCustomizer> currentTraceContextCustomizers) {
	if (scopeDecorators == null) {
		scopeDecorators = Collections.emptyList();
	}
	if (currentTraceContextCustomizers == null) {
		currentTraceContextCustomizers = Collections.emptyList();
	}

	for (CurrentTraceContext.ScopeDecorator scopeDecorator : scopeDecorators) {
		builder.addScopeDecorator(scopeDecorator);
	}
	for (CurrentTraceContextCustomizer customizer : currentTraceContextCustomizers) {
		customizer.customize(builder);
	}
	return builder.build();
}
 
Example 2
Source File: MDCScopeDecorator.java    From brave with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a scope decorator that configures {@link BaggageFields#TRACE_ID}, {@link
 * BaggageFields#PARENT_ID}, {@link BaggageFields#SPAN_ID} and {@link BaggageFields#SAMPLED}
 *
 * @since 5.2
 * @deprecated since 5.11 use {@link #get()} or {@link #newBuilder()}
 */
@Deprecated public static CurrentTraceContext.ScopeDecorator create() {
  return new Builder()
    .clear()
    .add(SingleCorrelationField.create(BaggageFields.TRACE_ID))
    .add(SingleCorrelationField.create(BaggageFields.PARENT_ID))
    .add(SingleCorrelationField.create(BaggageFields.SPAN_ID))
    .add(SingleCorrelationField.create(BaggageFields.SAMPLED))
    .build();
}
 
Example 3
Source File: ThreadContextScopeDecorator.java    From brave with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a scope decorator that configures {@link BaggageFields#TRACE_ID}, {@link
 * BaggageFields#PARENT_ID}, {@link BaggageFields#SPAN_ID} and {@link BaggageFields#SAMPLED}
 *
 * @since 5.2
 * @deprecated since 5.11 use {@link #get()} or {@link #newBuilder()}
 */
@Deprecated public static CurrentTraceContext.ScopeDecorator create() {
  return new Builder()
    .clear()
    .add(SingleCorrelationField.create(BaggageFields.TRACE_ID))
    .add(SingleCorrelationField.create(BaggageFields.PARENT_ID))
    .add(SingleCorrelationField.create(BaggageFields.SPAN_ID))
    .add(SingleCorrelationField.create(BaggageFields.SAMPLED))
    .build();
}
 
Example 4
Source File: MDCScopeDecorator.java    From brave with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a scope decorator that configures {@link BaggageFields#TRACE_ID}, {@link
 * BaggageFields#PARENT_ID}, {@link BaggageFields#SPAN_ID} and {@link BaggageFields#SAMPLED}
 *
 * @since 5.2
 * @deprecated since 5.11 use {@link #get()} or {@link #newBuilder()}
 */
@Deprecated public static CurrentTraceContext.ScopeDecorator create() {
  return new Builder()
    .clear()
    .add(SingleCorrelationField.create(BaggageFields.TRACE_ID))
    .add(SingleCorrelationField.create(BaggageFields.PARENT_ID))
    .add(SingleCorrelationField.create(BaggageFields.SPAN_ID))
    .add(SingleCorrelationField.create(BaggageFields.SAMPLED))
    .build();
}
 
Example 5
Source File: MDCScopeDecorator.java    From brave with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a singleton that configures {@link BaggageFields#TRACE_ID} and {@link
 * BaggageFields#SPAN_ID}.
 *
 * @since 5.11
 */
public static CurrentTraceContext.ScopeDecorator get() {
  return INSTANCE;
}
 
Example 6
Source File: ThreadContextScopeDecorator.java    From brave with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a singleton that configures {@link BaggageFields#TRACE_ID} and {@link
 * BaggageFields#SPAN_ID}.
 *
 * @since 5.11
 */
public static CurrentTraceContext.ScopeDecorator get() {
  return INSTANCE;
}
 
Example 7
Source File: MDCScopeDecorator.java    From brave with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a singleton that configures {@link BaggageFields#TRACE_ID} and {@link
 * BaggageFields#SPAN_ID}.
 *
 * @since 5.11
 */
public static CurrentTraceContext.ScopeDecorator get() {
  return INSTANCE;
}