Upgrade java formatter version.

This commit is contained in:
Tyler Benson 2018-07-19 14:04:10 +10:00
parent 37a54b5776
commit 12a2fce96d
23 changed files with 43 additions and 24 deletions

View File

@ -29,7 +29,7 @@ jobs:
- run:
name: Build Project
command: GRADLE_OPTS="-Dorg.gradle.jvmargs=-Xmx2G -Xms512M" ./gradlew clean :dd-java-agent:shadowJar compileTestGroovy compileTestScala compileTestJava check -x test -x traceAgentTest --build-cache --parallel --stacktrace --no-daemon --max-workers=4
command: GRADLE_OPTS="-Dorg.gradle.jvmargs=-Xmx2G -Xms512M" ./gradlew clean :dd-java-agent:shadowJar compileTestGroovy compileTestScala compileTestJava check -x test -x latestDepTest -x traceAgentTest --build-cache --parallel --stacktrace --no-daemon --max-workers=4
- run:
name: Collect Libs

View File

@ -32,7 +32,8 @@ public class ExceptionHandlers {
public Size apply(final MethodVisitor mv, final Implementation.Context context) {
// writes the following bytecode:
// try {
// org.slf4j.LoggerFactory.getLogger((Class)ExceptionLogger.class).debug("exception in instrumentation", t);
// org.slf4j.LoggerFactory.getLogger((Class)ExceptionLogger.class).debug("exception
// in instrumentation", t);
// } catch (Throwable t2) {
// }
final Label logStart = new Label();
@ -63,11 +64,13 @@ public class ExceptionHandlers {
mv.visitLabel(logEnd);
mv.visitJumpInsn(Opcodes.GOTO, handlerExit);
// if the runtime can't reach our ExceptionHandler or logger, silently eat the exception
// if the runtime can't reach our ExceptionHandler or logger, silently eat the
// exception
mv.visitLabel(eatException);
mv.visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] {"java/lang/Throwable"});
mv.visitInsn(Opcodes.POP);
// mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Throwable", "printStackTrace", "()V", false);
// mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Throwable", "printStackTrace",
// "()V", false);
mv.visitLabel(handlerExit);
mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);

View File

@ -90,7 +90,9 @@ public interface Instrumenter {
JavaModule module,
Class<?> classBeingRedefined,
ProtectionDomain protectionDomain) {
// Optimization: calling getInstrumentationMuzzle() inside this method prevents unnecessary loading of muzzle references during agentBuilder setup.
// Optimization: calling getInstrumentationMuzzle() inside this method
// prevents unnecessary loading of muzzle references during agentBuilder
// setup.
final ReferenceMatcher muzzle = getInstrumentationMuzzle();
if (null != muzzle) {
List<Reference.Mismatch> mismatches =

View File

@ -120,7 +120,8 @@ public class Reference {
private boolean onClasspath(final String className, final ClassLoader loader) {
final String resourceName = Utils.getResourceName(className);
return loader.getResource(resourceName) != null
// helper classes are not on the resource path because they are loaded with reflection (See HelperInjector)
// helper classes are not on the resource path because they are loaded with reflection (See
// HelperInjector)
|| (className.startsWith("datadog.trace.")
&& Utils.findLoadedClass(className, loader) != null)
// bootstrap class

View File

@ -1,4 +1,3 @@
import akka.NotUsed;
import akka.stream.javadsl.Source;
import com.lightbend.lagom.javadsl.api.ServiceCall;

View File

@ -59,7 +59,8 @@ public final class ClassLoaderInstrumentation extends Instrumenter.Default {
field.setAccessible(true);
final Object o = field.get(null);
// FIXME: This instrumentation will never work. Referencing class DDTracer will throw an exception.
// FIXME: This instrumentation will never work. Referencing class DDTracer will throw an
// exception.
if (o instanceof DDTracer) {
final DDTracer tracer = (DDTracer) o;
tracer.registerClassLoader(cl);

View File

@ -27,7 +27,8 @@ public class HystrixCommandInstrumentation extends Instrumenter.Default {
@Override
public ElementMatcher typeMatcher() {
// Not adding a version restriction because this should work with any version and add some benefit.
// Not adding a version restriction because this should work with any version and add some
// benefit.
return not(isInterface()).and(hasSuperType(named("com.netflix.hystrix.HystrixCommand")));
}

View File

@ -59,7 +59,8 @@ public final class PreparedStatementInstrumentation extends Instrumenter.Default
Connection connection;
try {
connection = statement.getConnection();
// unwrap the connection to cache the underlying actual connection and to not cache proxy objects
// unwrap the connection to cache the underlying actual connection and to not cache proxy
// objects
if (connection.isWrapperFor(Connection.class)) {
connection = connection.unwrap(Connection.class);
}

View File

@ -61,7 +61,8 @@ public final class StatementInstrumentation extends Instrumenter.Default {
try {
connection = statement.getConnection();
if (connection.isWrapperFor(Connection.class)) {
// unwrap the connection to cache the underlying actual connection and to not cache proxy objects
// unwrap the connection to cache the underlying actual connection and to not cache proxy
// objects
connection = connection.unwrap(Connection.class);
}
} catch (final Throwable e) {

View File

@ -98,7 +98,7 @@ public final class KafkaProducerInstrumentation extends Instrumenter.Default {
Format.Builtin.TEXT_MAP,
new TextMapInjectAdapter(record.headers()));
} catch (final IllegalStateException e) {
//headers must be read-only from reused record. try again with new one.
// headers must be read-only from reused record. try again with new one.
record =
new ProducerRecord<>(
record.topic(),

View File

@ -23,7 +23,8 @@ public class LettuceFluxCreationAdvice {
LettuceFluxTerminationRunnable handler =
new LettuceFluxTerminationRunnable(commandName, finishSpanOnClose);
publisher = publisher.doOnSubscribe(handler.getOnSubscribeConsumer());
// don't register extra callbacks to finish the spans if the command being instrumented is one of those that return
// don't register extra callbacks to finish the spans if the command being instrumented is one
// of those that return
// Mono<Void> (In here a flux is created first and then converted to Mono<Void>)
if (!finishSpanOnClose) {
publisher = publisher.doOnEach(handler);

View File

@ -95,7 +95,8 @@ public class LettuceFluxTerminationRunnable implements Consumer<Signal>, Runnabl
Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_CLIENT);
Tags.COMPONENT.set(span, LettuceInstrumentationUtil.COMPONENT_NAME);
// should be command name only, but use workaround to prepend string to agent crashing commands
// should be command name only, but use workaround to prepend string to agent crashing
// commands
span.setTag(
DDTags.RESOURCE_NAME,
LettuceInstrumentationUtil.getCommandResourceName(this.commandName));

View File

@ -14,7 +14,8 @@ public class LettuceMonoCreationAdvice {
return LettuceInstrumentationUtil.getCommandName(supplier.get());
}
// throwables wouldn't matter here, because no spans have been started due to redis command not being
// throwables wouldn't matter here, because no spans have been started due to redis command not
// being
// run until the user subscribes to the Mono publisher
@Advice.OnMethodExit(suppress = Throwable.class)
public static void monitorSpan(

View File

@ -110,7 +110,8 @@ public final class PlayInstrumentation extends Instrumenter.Default {
@Advice.Thrown final Throwable throwable,
@Advice.Argument(0) final Request req,
@Advice.Return(readOnly = false) Future<Result> responseFuture) {
// more about routes here: https://github.com/playframework/playframework/blob/master/documentation/manual/releases/release26/migration26/Migration26.md
// more about routes here:
// https://github.com/playframework/playframework/blob/master/documentation/manual/releases/release26/migration26/Migration26.md
final Option pathOption = req.tags().get("ROUTE_PATTERN");
if (!pathOption.isEmpty()) {
final String path = (String) pathOption.get();

View File

@ -28,7 +28,8 @@ public final class RatpackHttpClientInstrumentation extends Instrumenter.Default
@Override
protected boolean defaultEnabled() {
// FIXME: Injecting ContextualScopeManager is probably a bug. Verify and check all ratpack helpers before enabling.
// FIXME: Injecting ContextualScopeManager is probably a bug. Verify and check all ratpack
// helpers before enabling.
return false;
}

View File

@ -41,7 +41,7 @@ public final class WrappedRequestSpec implements RequestSpec {
*
*/
private Action<? super RequestSpec> redirectHandler(ReceivedResponse response) {
//handler.handleReceive(response.getStatusCode(), null, span.get());
// handler.handleReceive(response.getStatusCode(), null, span.get());
return (s) -> new WrappedRequestSpec(s, tracer, scope, spanRef);
}

View File

@ -155,7 +155,8 @@ public class TracingAgent {
private static ClassLoader getPlatformClassLoader()
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
// must invoke ClassLoader.getPlatformClassLoader by reflection to remain compatible with java 7 + 8.
// must invoke ClassLoader.getPlatformClassLoader by reflection to remain compatible with java 7
// + 8.
final Method method = ClassLoader.class.getDeclaredMethod("getPlatformClassLoader");
return (ClassLoader) method.invoke(null);
}

View File

@ -23,7 +23,7 @@ import org.spockframework.runtime.Sputnik;
* Runs a spock test in an agent-friendly way.
*
* <ul>
* <li> Adds agent bootstrap classes to bootstrap classpath.
* <li>Adds agent bootstrap classes to bootstrap classpath.
* </ul>
*/
public class SpockRunner extends Sputnik {

View File

@ -13,7 +13,7 @@ buildscript {
plugins {
id 'com.gradle.build-scan' version '1.14'
id 'com.github.sherter.google-java-format' version '0.6'
id 'com.github.sherter.google-java-format' version '0.7.1'
}
def isCI = System.getenv("CI") != null

View File

@ -31,7 +31,8 @@ public class PendingTrace extends ConcurrentLinkedDeque<DDSpan> {
private final DDTracer tracer;
private final long traceId;
// TODO: consider moving these time fields into DDTracer to ensure that traces have precise relative time
// TODO: consider moving these time fields into DDTracer to ensure that traces have precise
// relative time
/** Trace start time in nano seconds measured up to a millisecond accuracy */
private final long startTimeNano;
/** Nano second ticks value at trace start */

View File

@ -1,4 +1,3 @@
package datadog.trace.common.sampling;
import com.fasterxml.jackson.databind.JsonNode;

View File

@ -14,7 +14,9 @@ import java.util.concurrent.TimeUnit;
* <p>The JDK provides two clocks:
* <li>one in nanoseconds, for precision, but it can only use to measure durations
* <li>one in milliseconds, for accuracy, useful to provide epoch time
*
* <p>
*
* <p>At this time, we are using a millis precision (converted to micros) in order to guarantee
* consistency between the span start times and the durations
*/

View File

@ -53,7 +53,9 @@ tasks.withType(Test) {
apply plugin: 'com.github.sherter.google-java-format'
googleJavaFormat {
exclude 'gradle-home'
source = sourceSets*.allJava
include '**/*.java'
exclude '**/build/**/*.java'
}
tasks.withType(Checkstyle) {