checkstyle with fever

This commit is contained in:
Adrian Cole
2020-04-03 20:41:59 +08:00
parent b79f8897c2
commit eddc0308ae
4 changed files with 13 additions and 8 deletions

View File

@@ -16,21 +16,23 @@
package org.springframework.cloud.sleuth.instrument.reactor;
import java.util.function.Function;
import brave.Tracing;
import brave.propagation.CurrentTraceContext;
import brave.propagation.TraceContext;
import java.util.function.Function;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.reactivestreams.Publisher;
import org.springframework.cloud.sleuth.internal.LazyBean;
import org.springframework.context.ConfigurableApplicationContext;
import reactor.core.CoreSubscriber;
import reactor.core.Fuseable;
import reactor.core.Scannable;
import reactor.core.publisher.Operators;
import reactor.util.context.Context;
import org.springframework.cloud.sleuth.internal.LazyBean;
import org.springframework.context.ConfigurableApplicationContext;
/**
* Reactive Span pointcuts factories.
*
@@ -81,7 +83,7 @@ public abstract class ReactorSleuth {
if (!springContext.isActive()) {
boolean assertOn = false;
assert assertOn = true; // gives a message in unit tests even if trace disabled!
assert assertOn = true; // gives a message in unit test failures
if (log.isTraceEnabled() || assertOn) {
String message = "Spring Context [" + springContext
+ "] is not yet refreshed. This is unexpected. Reactor Context is ["
@@ -103,7 +105,7 @@ public abstract class ReactorSleuth {
CurrentTraceContext currentTraceContext = lazyCurrentTraceContext.get();
if (currentTraceContext == null) {
boolean assertOn = false;
assert assertOn = true; // gives a message in unit tests even if trace disabled!
assert assertOn = true; // gives a message in unit test failures
if (log.isTraceEnabled() || assertOn) {
String message = "Spring Context [" + springContext
+ "] did not return a CurrentTraceContext. Reactor Context is ["

View File

@@ -43,6 +43,7 @@ import org.springframework.cloud.sleuth.autoconfig.SleuthProperties;
* @since 2.1.0
*/
final class Slf4jScopeDecorator implements ScopeDecorator {
// Backward compatibility for all logging patterns
private static final ScopeDecorator LEGACY_IDS = MDCScopeDecorator.newBuilder()
.clear()

View File

@@ -175,9 +175,10 @@ public class Slf4JSpanLoggerTest {
public void should_only_include_whitelist() {
assertThat(this.slf4jScopeDecorator).extracting("delegate.fields")
.asInstanceOf(InstanceOfAssertFactories.array(CorrelationField[].class))
.extracting(CorrelationField::name).containsExactly("traceId", "parentId",
"spanId", "spanExportable", "my-baggage", "my-local",
"my-propagation"); // my-baggage-two is baggage not in the whitelist
.extracting(CorrelationField::name)
// my-baggage-two is baggage not in the whitelist
.containsExactly("traceId", "parentId", "spanId", "spanExportable",
"my-baggage", "my-local", "my-propagation");
}
@Test

View File

@@ -4,6 +4,7 @@
"https://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress files=".*/test/.*" checks="JavadocVariable"/>
<suppress files=".*ReactorSleuth\.java" checks="InnerAssignment"/>
<suppress files=".*FinishedSpanHandlerTests.*" checks="LineLengthCheck"/>
<suppress files=".*GrpcTracingIntegrationTests.*" checks="LineLengthCheck"/>
<suppress files=".*IgnoreAutoConfiguredSkipPatternsIntegrationTests.*" checks="LineLengthCheck"/>