Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ object AkkaHttpTestAsyncWebServer {
case QUERY_PARAM => resp.withEntity(uri.queryString().orNull)
case REDIRECT =>
resp.withHeaders(headers.Location(endpoint.getBody))
case ERROR => resp.withEntity(endpoint.getBody)
case EXCEPTION => throw new Exception(endpoint.getBody)
case ERROR => resp.withEntity(endpoint.getBody)
case EXCEPTION =>
throw new IllegalStateException(endpoint.getBody)
case _ =>
HttpResponse(status = NOT_FOUND.getStatus)
.withEntity(NOT_FOUND.getBody)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ object AkkaHttpTestSyncWebServer {
case QUERY_PARAM => resp.withEntity(uri.queryString().orNull)
case REDIRECT =>
resp.withHeaders(headers.Location(endpoint.getBody))
case ERROR => resp.withEntity(endpoint.getBody)
case EXCEPTION => throw new Exception(endpoint.getBody)
case ERROR => resp.withEntity(endpoint.getBody)
case EXCEPTION =>
throw new IllegalStateException(endpoint.getBody)
case _ =>
HttpResponse(status = NOT_FOUND.getStatus)
.withEntity(NOT_FOUND.getBody)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected Server setupServer() {
.runWithSpan(
"controller",
() -> {
throw new Exception(EXCEPTION.getBody());
throw new IllegalStateException(EXCEPTION.getBody());
}));

sb.service(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class FinatraController extends Controller {
any(EXCEPTION.getPath) { request: Request =>
controller(
EXCEPTION,
supplier(() => throw new Exception(EXCEPTION.getBody))
supplier(() => throw new IllegalStateException(EXCEPTION.getBody))
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ class FinatraServerLatestTest extends AbstractHttpServerTest[HttpServer] {
if (endpoint == ServerEndpoint.EXCEPTION) {
span
.hasStatus(StatusData.error())
.hasException(new Exception(ServerEndpoint.EXCEPTION.getBody))
.hasException(
new IllegalStateException(ServerEndpoint.EXCEPTION.getBody)
)
}

span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class FinatraController extends Controller {
any(EXCEPTION.getPath) { request: Request =>
controller(
EXCEPTION,
supplier(() => throw new Exception(EXCEPTION.getBody))
supplier(() => throw new IllegalStateException(EXCEPTION.getBody))
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ class FinatraServerTest extends AbstractHttpServerTest[HttpServer] {
if (endpoint == ServerEndpoint.EXCEPTION) {
span
.hasStatus(StatusData.error())
.hasException(new Exception(ServerEndpoint.EXCEPTION.getBody))
.hasException(
new IllegalStateException(ServerEndpoint.EXCEPTION.getBody)
)
}

span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class TestController implements Controller {
@Action
def exception() {
controller(EXCEPTION) {
throw new Exception(EXCEPTION.body)
throw new IllegalStateException(EXCEPTION.body)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public SpanDataAssert assertHandlerSpan(
span.hasName(getHandlerSpanName(endpoint)).hasKind(SpanKind.INTERNAL);
if (endpoint == EXCEPTION) {
span.hasStatus(StatusData.error());
span.hasException(new Exception(EXCEPTION.getBody()));
span.hasException(new IllegalStateException(EXCEPTION.getBody()));
}
return span;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ protected void configure(HttpServerTestOptions options) {
Sets.difference(
DEFAULT_HTTP_ATTRIBUTES, Collections.singleton(HttpAttributes.HTTP_ROUTE)));
options.setHasResponseSpan(endpoint -> endpoint == REDIRECT || endpoint == ERROR);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
options.setHasResponseCustomizer(endpoint -> true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ protected void configure(HttpServerTestOptions options) {
unused ->
Sets.difference(
DEFAULT_HTTP_ATTRIBUTES, Collections.singleton(HttpAttributes.HTTP_ROUTE)));
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
options.setHasResponseCustomizer(endpoint -> endpoint != EXCEPTION);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ protected void configure(HttpServerTestOptions options) {
Sets.difference(
DEFAULT_HTTP_ATTRIBUTES, Collections.singleton(HttpAttributes.HTTP_ROUTE)));
options.setHasResponseSpan(endpoint -> endpoint == REDIRECT || endpoint == ERROR);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
options.setHasResponseCustomizer(endpoint -> endpoint != EXCEPTION);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class KtorHttpServerTest : AbstractHttpServerTest<ApplicationEngine>() {

get(ServerEndpoint.EXCEPTION.path) {
controller(ServerEndpoint.EXCEPTION) {
throw Exception(ServerEndpoint.EXCEPTION.body)
throw IllegalStateException(ServerEndpoint.EXCEPTION.body)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ abstract class AbstractKtorHttpServerTest : AbstractHttpServerTest<ApplicationEn

get(ServerEndpoint.EXCEPTION.path) {
controller(ServerEndpoint.EXCEPTION) {
throw Exception(ServerEndpoint.EXCEPTION.body)
throw IllegalStateException(ServerEndpoint.EXCEPTION.body)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ object PekkoHttpTestAsyncWebServer {
case QUERY_PARAM => resp.withEntity(uri.queryString().orNull)
case REDIRECT =>
resp.withHeaders(headers.Location(endpoint.getBody))
case ERROR => resp.withEntity(endpoint.getBody)
case EXCEPTION => throw new Exception(endpoint.getBody)
case ERROR => resp.withEntity(endpoint.getBody)
case EXCEPTION =>
throw new IllegalStateException(endpoint.getBody)
case _ =>
HttpResponse(status = NOT_FOUND.getStatus)
.withEntity(NOT_FOUND.getBody)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ object PekkoHttpTestSyncWebServer {
case REDIRECT =>
resp.withHeaders(headers.Location(endpoint.getBody))
case ERROR => resp.withEntity(endpoint.getBody)
case EXCEPTION => throw new Exception(endpoint.getBody)
case EXCEPTION => throw new IllegalStateException(endpoint.getBody)
case _ =>
HttpResponse(status = NOT_FOUND.getStatus)
.withEntity(NOT_FOUND.getBody)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ protected void configure(HttpServerTestOptions options) {
options.setTestPathParam(true);
options.setTestErrorBody(false);
options.setTestHttpPipelining(false);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
options.setExpectedHttpRoute(
(endpoint, method) -> {
if (HttpConstants._OTHER.equals(method)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ protected void configure(HttpServerTestOptions options) {
super.configure(options);
options.setTestPathParam(true);
options.setTestErrorBody(false);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
options.setExpectedHttpRoute(
(endpoint, method) -> {
if (HttpConstants._OTHER.equals(method)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ protected void configure(HttpServerTestOptions options) {
options.setTestCaptureHttpHeaders(false);
options.setHasResponseSpan(e -> e.equals(REDIRECT) || e.equals(ERROR));
options.setHasResponseCustomizer(e -> true);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ protected void configure(HttpServerTestOptions options) {
options.setTestCaptureRequestParameters(true);
options.setHasResponseCustomizer(e -> true);
options.setHasResponseSpan(this::hasResponseSpan);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
}

protected boolean hasResponseSpan(ServerEndpoint endpoint) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public static boolean isBefore94() {
protected void configure(HttpServerTestOptions options) {
super.configure(options);
options.setTestNotFound(false);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
options.setContextPath("/jetty-context");
options.setVerifyServerSpanEndTime(!isAsyncTest());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ protected void configure(HttpServerTestOptions options) {
super.configure(options);
options.setContextPath("");
options.setTestNotFound(false);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
options.setHttpAttributes(
serverEndpoint -> {
Set<AttributeKey<?>> attributes =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package io.opentelemetry.javaagent.instrumentation.servlet.v3_0.tomcat;

import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.ERROR;
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.EXCEPTION;
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.NOT_FOUND;
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.SUCCESS;
import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -71,7 +70,6 @@ public abstract class TomcatServlet3Test extends AbstractServlet3Test<Tomcat, Co
@Override
protected void configure(HttpServerTestOptions options) {
super.configure(options);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
options.setContextPath("/tomcat-context");
options.setTestError(testError());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

package io.opentelemetry.javaagent.instrumentation.servlet.v5_0.jetty;

import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.EXCEPTION;

import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
import io.opentelemetry.instrumentation.testing.junit.http.HttpServerInstrumentationExtension;
import io.opentelemetry.instrumentation.testing.junit.http.HttpServerTestOptions;
Expand All @@ -32,7 +30,6 @@ public abstract class JettyServlet5Test
protected void configure(HttpServerTestOptions options) {
super.configure(options);
options.setTestNotFound(false);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
options.setContextPath("/jetty-context");
}

Expand Down Expand Up @@ -67,8 +64,7 @@ public void stopServer(Server server) throws Exception {

@Override
public void addServlet(
ServletContextHandler servletContext, String path, Class<? extends Servlet> servlet)
throws Exception {
ServletContextHandler servletContext, String path, Class<? extends Servlet> servlet) {
servletContext.addServlet(servlet, path);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

package io.opentelemetry.javaagent.instrumentation.servlet.v5_0.jetty;

import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.EXCEPTION;

import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
import io.opentelemetry.instrumentation.testing.junit.http.HttpServerInstrumentationExtension;
Expand Down Expand Up @@ -36,7 +34,6 @@ protected void configure(HttpServerTestOptions options) {
super.configure(options);
options.setContextPath("");
options.setTestNotFound(false);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
options.setHttpAttributes(
serverEndpoint -> {
Set<AttributeKey<?>> attributes =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

package io.opentelemetry.javaagent.instrumentation.servlet.v5_0.jetty12;

import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.EXCEPTION;

import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
import io.opentelemetry.instrumentation.testing.junit.http.HttpServerInstrumentationExtension;
import io.opentelemetry.instrumentation.testing.junit.http.HttpServerTestOptions;
Expand All @@ -30,7 +28,6 @@ public abstract class Jetty12Servlet5Test
protected void configure(HttpServerTestOptions options) {
super.configure(options);
options.setTestNotFound(false);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
options.setContextPath("/jetty-context");
}

Expand Down Expand Up @@ -64,8 +61,7 @@ public void stopServer(Server server) throws Exception {

@Override
public void addServlet(
ServletContextHandler servletContext, String path, Class<? extends Servlet> servlet)
throws Exception {
ServletContextHandler servletContext, String path, Class<? extends Servlet> servlet) {
servletContext.addServlet(servlet, path);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ protected void configure(HttpServerTestOptions options) {
options.setTestCaptureRequestParameters(true);
options.setHasResponseCustomizer(e -> true);
options.setHasResponseSpan(this::hasResponseSpan);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
}

protected boolean hasResponseSpan(ServerEndpoint endpoint) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package io.opentelemetry.javaagent.instrumentation.servlet.v5_0.tomcat;

import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.ERROR;
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.EXCEPTION;
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.NOT_FOUND;
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.SUCCESS;
import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -71,7 +70,6 @@ public abstract class TomcatServlet5Test extends AbstractServlet5Test<Tomcat, Co
@Override
protected void configure(HttpServerTestOptions options) {
super.configure(options);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
options.setContextPath("/tomcat-context");
options.setTestError(testError());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package io.opentelemetry.javaagent.instrumentation.spring.webflux.v5_0.server.base;

import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.EXCEPTION;
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.NOT_FOUND;
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.PATH_PARAM;

Expand Down Expand Up @@ -63,7 +62,6 @@ public String expectedHttpRoute(ServerEndpoint endpoint, String method) {
@Override
protected void configure(HttpServerTestOptions options) {
options.setTestPathParam(true);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
options.setHasHandlerSpan(unused -> true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ protected void configure(HttpServerTestOptions options) {
options.setHasResponseSpan(
endpoint -> endpoint == REDIRECT || endpoint == ERROR || endpoint == NOT_FOUND);
options.setTestPathParam(true);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ protected void configure(HttpServerTestOptions options) {
options.setTestPathParam(true);
options.setTestErrorBody(false);
options.setHasHandlerSpan(endpoint -> !endpoint.equals(NOT_FOUND));
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
options.setHasResponseSpan(
endpoint ->
endpoint == REDIRECT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ protected void configure(HttpServerTestOptions options) {
return super.expectedHttpRoute(endpoint, method);
});

options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
options.setHasResponseSpan(endpoint -> endpoint == NOT_FOUND || endpoint == REDIRECT);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ protected void configure(HttpServerTestOptions options) {
options.setHasResponseCustomizer(serverEndpoint -> true);
options.setTestCaptureRequestParameters(true);
options.setTestErrorBody(false);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));

options.setHasResponseSpan(
endpoint -> endpoint == REDIRECT || endpoint == ERROR || endpoint == NOT_FOUND);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ protected void configure(HttpServerTestOptions options) {
return super.expectedHttpRoute(endpoint, method);
});

options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
options.setHasResponseSpan(endpoint -> endpoint == NOT_FOUND || endpoint == REDIRECT);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ protected void configure(HttpServerTestOptions options) {
options.setHasResponseCustomizer(serverEndpoint -> true);
options.setTestCaptureRequestParameters(true);
options.setTestErrorBody(false);
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));

options.setHasResponseSpan(
endpoint -> endpoint == REDIRECT || endpoint == ERROR || endpoint == NOT_FOUND);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest;
import io.opentelemetry.instrumentation.testing.junit.http.HttpServerInstrumentationExtension;
import io.opentelemetry.instrumentation.testing.junit.http.HttpServerTestOptions;
import io.opentelemetry.instrumentation.testing.util.ThrowingRunnable;
import io.opentelemetry.semconv.ClientAttributes;
import io.opentelemetry.semconv.ExceptionAttributes;
import io.opentelemetry.semconv.HttpAttributes;
Expand Down Expand Up @@ -106,10 +105,9 @@ public Undertow setupServer() {
exchange ->
testing.runWithSpan(
"controller",
(ThrowingRunnable<Exception>)
() -> {
throw new Exception(EXCEPTION.getBody());
}))
() -> {
throw new IllegalStateException(EXCEPTION.getBody());
}))
.addExactPath(
INDEXED_CHILD.rawPath(),
exchange ->
Expand Down
Loading
Loading