Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: open-telemetry/opentelemetry-java-instrumentation
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 859b17884efec6ceca3d4b366c72c415390ba206
Choose a base ref
..
head repository: open-telemetry/opentelemetry-java-instrumentation
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3a3269fb0dc0be36aac76a5cc1e1a4810eacb4ef
Choose a head ref
Original file line number Diff line number Diff line change
@@ -58,7 +58,8 @@ protected RatpackServer setupServer() throws Exception {
ratpackServerSpec.handlers(
handlerChain -> {
handlerChain.register(
registrySpec -> registrySpec.add(ServerErrorHandler.class, new TestErrorHandler()));
registrySpec ->
registrySpec.add(ServerErrorHandler.class, new TestErrorHandler()));
handlerChain.prefix(
SUCCESS.rawPath(),
chain ->
@@ -77,15 +78,18 @@ protected RatpackServer setupServer() throws Exception {

handlerChain.prefix(
INDEXED_CHILD.rawPath(),
chain -> chain.all(
context -> process(
chain ->
chain.all(
context ->
process(
INDEXED_CHILD,
endpoint ->
controller(
endpoint,
() -> {
endpoint.collectSpanAttributes(
name -> context
name ->
context
.getRequest()
.getQueryParams()
.get(name));
@@ -97,8 +101,10 @@ protected RatpackServer setupServer() throws Exception {

handlerChain.prefix(
QUERY_PARAM.rawPath(),
chain -> chain.all(
context -> process(
chain ->
chain.all(
context ->
process(
QUERY_PARAM,
endpoint ->
controller(
@@ -111,17 +117,22 @@ protected RatpackServer setupServer() throws Exception {

handlerChain.prefix(
REDIRECT.rawPath(),
chain -> chain.all(
context -> process(
chain ->
chain.all(
context ->
process(
REDIRECT,
endpoint ->
controller(
endpoint, () -> context.redirect(endpoint.getBody())))));
endpoint,
() -> context.redirect(endpoint.getBody())))));

handlerChain.prefix(
ERROR.rawPath(),
chain -> chain.all(
context -> process(
chain ->
chain.all(
context ->
process(
ERROR,
endpoint ->
controller(
@@ -134,8 +145,10 @@ protected RatpackServer setupServer() throws Exception {

handlerChain.prefix(
EXCEPTION.rawPath(),
chain -> chain.all(
context -> process(
chain ->
chain.all(
context ->
process(
EXCEPTION,
endpoint ->
controller(
@@ -146,8 +159,10 @@ protected RatpackServer setupServer() throws Exception {

handlerChain.prefix(
"path/:id/param",
chain -> chain.all(
context -> process(
chain ->
chain.all(
context ->
process(
PATH_PARAM,
endpoint ->
controller(
@@ -160,8 +175,10 @@ protected RatpackServer setupServer() throws Exception {

handlerChain.prefix(
CAPTURE_HEADERS.rawPath(),
chain -> chain.all(
context -> process(
chain ->
chain.all(
context ->
process(
CAPTURE_HEADERS,
endpoint ->
controller(
@@ -182,8 +199,10 @@ protected RatpackServer setupServer() throws Exception {

handlerChain.prefix(
POST_STREAM.rawPath(),
chain -> chain.all(
context -> process(POST_STREAM, endpoint -> handlePostStream(context))));
chain ->
chain.all(
context ->
process(POST_STREAM, endpoint -> handlePostStream(context))));

registerHandlers(handlerChain);
});
Original file line number Diff line number Diff line change
@@ -140,13 +140,15 @@ void bindingsForPath(String path, String route) {
port.satisfiesAnyOf(
val -> assertThat(val).isInstanceOf(Long.class),
val -> assertThat(val).isNull())),
satisfies(NETWORK_PEER_PORT, val -> {
if (hasHandlerSpan()) {
val.isInstanceOf(Long.class);
} else {
val.isNull();
}
}),
satisfies(
NETWORK_PEER_PORT,
val -> {
if (hasHandlerSpan()) {
val.isInstanceOf(Long.class);
} else {
val.isNull();
}
}),
equalTo(HTTP_REQUEST_METHOD, "GET"),
equalTo(HTTP_RESPONSE_STATUS_CODE, 200),
satisfies(USER_AGENT_ORIGINAL, val -> val.isInstanceOf(String.class)),
Original file line number Diff line number Diff line change
@@ -879,6 +879,10 @@ public final boolean hasHttpRouteAttribute(ServerEndpoint endpoint) {
return options.httpAttributes.apply(endpoint).contains(HttpAttributes.HTTP_ROUTE);
}

public final boolean hasHandlerSpan(ServerEndpoint endpoint) {
return options.hasHandlerSpan.test(endpoint);
}

public String expectedHttpRoute(ServerEndpoint endpoint, String method) {
// no need to compute route if we're not expecting it
if (!hasHttpRouteAttribute(endpoint)) {