Fix Ratpack instrumentation for newer versions of Guava. (#360)
Ratpack 1.4 should still work if you increase your guava version to 20+ (instead of 19). Co-authored-by: Tyler Benson <tyler.benson@datadoghq.com>
This commit is contained in:
parent
9568ba079b
commit
3c4a6b545c
|
@ -11,13 +11,9 @@ muzzle {
|
|||
pass {
|
||||
group = "io.ratpack"
|
||||
module = 'ratpack-core'
|
||||
versions = "[1.4.0,)"
|
||||
}
|
||||
// Some maven dependencies are missing for pre 1.0 ratpack, so we can't assertInverse.
|
||||
fail {
|
||||
group = "io.ratpack"
|
||||
module = 'ratpack-core'
|
||||
versions = "[1.0,1.4.0)"
|
||||
versions = "[1.5.0,)"
|
||||
skipVersions += ["0.9.12", "0.9.13", "0.9.14",]
|
||||
assertInverse = true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,9 +24,9 @@ testSets {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
main_java8CompileOnly group: 'io.ratpack', name: 'ratpack-core', version: '1.4.0'
|
||||
main_java8CompileOnly group: 'io.ratpack', name: 'ratpack-core', version: '1.5.0'
|
||||
|
||||
testCompile project(':instrumentation:netty:netty-4.1')
|
||||
testCompile group: 'io.ratpack', name: 'ratpack-groovy-test', version: '1.4.0'
|
||||
testCompile group: 'io.ratpack', name: 'ratpack-groovy-test', version: '1.5.0'
|
||||
latestDepTestCompile group: 'io.ratpack', name: 'ratpack-groovy-test', version: '+'
|
||||
}
|
|
@ -23,6 +23,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
|
|||
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
||||
|
||||
import com.google.auto.service.AutoService;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import io.opentelemetry.auto.tooling.Instrumenter;
|
||||
import java.util.Map;
|
||||
import net.bytebuddy.asm.Advice;
|
||||
|
@ -70,9 +71,12 @@ public final class ContinuationInstrumentation extends Instrumenter.Default {
|
|||
block = BlockWrapper.wrapIfNeeded(block);
|
||||
}
|
||||
|
||||
public void muzzleCheck(final PathBinding binding) {
|
||||
public void muzzleCheck(final PathBinding binding, final HostAndPort host) {
|
||||
// This was added in 1.4. Added here to ensure consistency with other instrumentation.
|
||||
binding.getDescription();
|
||||
|
||||
// This is available in Guava 20 which was required starting in 1.5
|
||||
host.getHost();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
|
|||
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
||||
|
||||
import com.google.auto.service.AutoService;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import io.opentelemetry.auto.tooling.Instrumenter;
|
||||
import java.util.Map;
|
||||
import net.bytebuddy.asm.Advice;
|
||||
|
@ -67,9 +68,12 @@ public final class DefaultExecutionInstrumentation extends Instrumenter.Default
|
|||
segment = ActionWrapper.wrapIfNeeded(segment);
|
||||
}
|
||||
|
||||
public void muzzleCheck(final PathBinding binding) {
|
||||
public void muzzleCheck(final PathBinding binding, final HostAndPort host) {
|
||||
// This was added in 1.4. Added here to ensure consistency with other instrumentation.
|
||||
binding.getDescription();
|
||||
|
||||
// This is available in Guava 20 which was required starting in 1.5
|
||||
host.getHost();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -54,7 +54,7 @@ public class RatpackServerDecorator extends HttpServerDecorator<Request, Request
|
|||
|
||||
@Override
|
||||
protected String peerHostIP(final Request request) {
|
||||
return request.getRemoteAddress().getHostText();
|
||||
return request.getRemoteAddress().getHost();
|
||||
}
|
||||
|
||||
@Override
|
|
@ -120,7 +120,7 @@ include ':instrumentation:play-ws:play-ws-2.0'
|
|||
include ':instrumentation:play-ws:play-ws-2.1'
|
||||
include ':instrumentation:play-ws:play-ws-common'
|
||||
include ':instrumentation:rabbitmq-amqp-2.7'
|
||||
include ':instrumentation:ratpack-1.4'
|
||||
include ':instrumentation:ratpack-1.5'
|
||||
include ':instrumentation:reactor-3.1'
|
||||
include ':instrumentation:rmi'
|
||||
include ':instrumentation:rxjava-1.0'
|
||||
|
|
Loading…
Reference in New Issue