Skip to content

Commit f30601d

Browse files
authored
Test latest struts 6.x version (#12948)
1 parent aeb1b78 commit f30601d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

instrumentation/struts/struts-2.3/javaagent/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dependencies {
2727
testInstrumentation(project(":instrumentation:jetty:jetty-8.0:javaagent"))
2828
testInstrumentation(project(":instrumentation:struts:struts-7.0:javaagent"))
2929

30-
latestDepTestLibrary("org.apache.struts:struts2-core:6.0.+")
30+
latestDepTestLibrary("org.apache.struts:struts2-core:6.+")
3131
}
3232

3333
tasks.withType<Test>().configureEach {

instrumentation/struts/struts-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/struts/v7_0/Struts2InstrumentationModule.java

+8
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55

66
package io.opentelemetry.javaagent.instrumentation.struts.v7_0;
77

8+
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed;
89
import static java.util.Collections.singletonList;
910

1011
import com.google.auto.service.AutoService;
1112
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
1213
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
1314
import java.util.List;
15+
import net.bytebuddy.matcher.ElementMatcher;
1416

1517
@AutoService(InstrumentationModule.class)
1618
public class Struts2InstrumentationModule extends InstrumentationModule {
@@ -19,6 +21,12 @@ public Struts2InstrumentationModule() {
1921
super("struts", "struts-7.0");
2022
}
2123

24+
@Override
25+
public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
26+
// class is in different package before 7.0
27+
return hasClassesNamed("org.apache.struts2.config.entities.ActionConfig");
28+
}
29+
2230
@Override
2331
public List<TypeInstrumentation> typeInstrumentations() {
2432
return singletonList(new ActionInvocationInstrumentation());

0 commit comments

Comments
 (0)