Skip to content

Commit

Permalink
Test latest struts 6.x version (#12948)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurit authored Dec 22, 2024
1 parent aeb1b78 commit f30601d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies {
testInstrumentation(project(":instrumentation:jetty:jetty-8.0:javaagent"))
testInstrumentation(project(":instrumentation:struts:struts-7.0:javaagent"))

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

tasks.withType<Test>().configureEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

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

import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed;
import static java.util.Collections.singletonList;

import com.google.auto.service.AutoService;
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import java.util.List;
import net.bytebuddy.matcher.ElementMatcher;

@AutoService(InstrumentationModule.class)
public class Struts2InstrumentationModule extends InstrumentationModule {
Expand All @@ -19,6 +21,12 @@ public Struts2InstrumentationModule() {
super("struts", "struts-7.0");
}

@Override
public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
// class is in different package before 7.0
return hasClassesNamed("org.apache.struts2.config.entities.ActionConfig");
}

@Override
public List<TypeInstrumentation> typeInstrumentations() {
return singletonList(new ActionInvocationInstrumentation());
Expand Down

0 comments on commit f30601d

Please sign in to comment.