File tree Expand file tree Collapse file tree
instrumentation/wicket-8.0
common-testing/src/main/java/io/opentelemetry/javaagent/instrumentation/wicket/v8_0
javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/wicket/v8_0 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222
2323abstract class AbstractWicketTest <SERVER > extends AbstractHttpServerUsingTest <SERVER > {
2424
25+ private static final boolean V3_PREVIEW =
26+ Boolean .getBoolean ("otel.instrumentation.common.v3-preview" );
27+
2528 @ RegisterExtension
2629 private static final InstrumentationExtension testing =
2730 HttpServerInstrumentationExtension .forAgent ();
@@ -89,8 +92,15 @@ void testResource() {
8992 trace ->
9093 trace .hasSpansSatisfyingExactly (
9194 span ->
92- span .hasName ("GET " + getContextPath () + "/wicket-test/hello.HelloResource" )
95+ span .hasName (expectedResourceSpanName () )
9396 .hasKind (SpanKind .SERVER )
9497 .hasNoParent ()));
9598 }
99+
100+ private String expectedResourceSpanName () {
101+ if (V3_PREVIEW ) {
102+ return "GET " + getContextPath () + "/wicket-test/hello.HelloResource" ;
103+ }
104+ return "GET " + getContextPath () + "/wicket-test/*" ;
105+ }
96106}
Original file line number Diff line number Diff line change 55
66package io .opentelemetry .javaagent .instrumentation .wicket .v8_0 ;
77
8+ import static io .opentelemetry .instrumentation .api .internal .SemconvStability .v3Preview ;
89import static io .opentelemetry .instrumentation .api .semconv .http .HttpServerRouteSource .CONTROLLER ;
910import static io .opentelemetry .javaagent .instrumentation .wicket .v8_0 .WicketServerSpanNaming .serverSpanName ;
1011import static io .opentelemetry .javaagent .instrumentation .wicket .v8_0 .WicketServerSpanNaming .serverSpanNameResource ;
@@ -48,7 +49,7 @@ public static void onEnter(@Advice.Argument(0) IRequestHandler handler) {
4849 serverSpanName (),
4950 (IPageClassRequestHandler ) handler );
5051 }
51- if (handler instanceof ResourceReferenceRequestHandler ) {
52+ if (handler instanceof ResourceReferenceRequestHandler && v3Preview () ) {
5253 HttpServerRoute .update (
5354 Java8BytecodeBridge .currentContext (),
5455 CONTROLLER ,
Original file line number Diff line number Diff line change @@ -16,3 +16,15 @@ dependencies {
1616otelJava {
1717 minJavaVersionSupported.set(JavaVersion .VERSION_17 )
1818}
19+
20+ tasks {
21+ val testV3Preview by registering(Test ::class ) {
22+ testClassesDirs = sourceSets.test.get().output.classesDirs
23+ classpath = sourceSets.test.get().runtimeClasspath
24+ jvmArgs(" -Dotel.instrumentation.common.v3-preview=true" )
25+ }
26+
27+ check {
28+ dependsOn(testV3Preview)
29+ }
30+ }
Original file line number Diff line number Diff line change @@ -21,3 +21,15 @@ if (otelProps.testLatestDeps) {
2121 minJavaVersionSupported.set(JavaVersion .VERSION_11 )
2222 }
2323}
24+
25+ tasks {
26+ val testV3Preview by registering(Test ::class ) {
27+ testClassesDirs = sourceSets.test.get().output.classesDirs
28+ classpath = sourceSets.test.get().runtimeClasspath
29+ jvmArgs(" -Dotel.instrumentation.common.v3-preview=true" )
30+ }
31+
32+ check {
33+ dependsOn(testV3Preview)
34+ }
35+ }
You can’t perform that action at this time.
0 commit comments