File tree Expand file tree Collapse file tree 4 files changed +11
-15
lines changed
instrumentation/spring/spring-webmvc/spring-webmvc-3.1/javaagent
src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webmvc/v3_1 Expand file tree Collapse file tree 4 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ dependencies {
2727 compileOnly(" javax.servlet:javax.servlet-api:3.1.0" )
2828
2929 // Include servlet instrumentation for verifying the tomcat requests
30+ testInstrumentation(project(" :instrumentation:spring:spring-webmvc:spring-webmvc-6.0:javaagent" ))
3031 testInstrumentation(project(" :instrumentation:servlet:servlet-3.0:javaagent" ))
3132 testInstrumentation(project(" :instrumentation:tomcat:tomcat-7.0:javaagent" ))
3233 testInstrumentation(project(" :instrumentation:spring:spring-web:spring-web-3.1:javaagent" ))
Original file line number Diff line number Diff line change 66package io .opentelemetry .javaagent .instrumentation .spring .webmvc .v3_1 ;
77
88import static io .opentelemetry .javaagent .instrumentation .spring .webmvc .v3_1 .SpringWebMvcSingletons .modelAndViewInstrumenter ;
9- import static net .bytebuddy .matcher .ElementMatchers .isMethod ;
109import static net .bytebuddy .matcher .ElementMatchers .isProtected ;
1110import static net .bytebuddy .matcher .ElementMatchers .named ;
1211import static net .bytebuddy .matcher .ElementMatchers .takesArgument ;
@@ -37,15 +36,13 @@ public ElementMatcher<TypeDescription> typeMatcher() {
3736 @ Override
3837 public void transform (TypeTransformer transformer ) {
3938 transformer .applyAdviceToMethod (
40- isMethod ()
41- .and (isProtected ())
39+ isProtected ()
4240 .and (named ("onRefresh" ))
4341 .and (takesArgument (0 , named ("org.springframework.context.ApplicationContext" )))
4442 .and (takesArguments (1 )),
4543 DispatcherServletInstrumentation .class .getName () + "$HandlerMappingAdvice" );
4644 transformer .applyAdviceToMethod (
47- isMethod ()
48- .and (isProtected ())
45+ isProtected ()
4946 .and (named ("render" ))
5047 .and (takesArgument (0 , named ("org.springframework.web.servlet.ModelAndView" ))),
5148 DispatcherServletInstrumentation .class .getName () + "$RenderAdvice" );
Original file line number Diff line number Diff line change 99import static io .opentelemetry .javaagent .extension .matcher .AgentElementMatchers .hasClassesNamed ;
1010import static io .opentelemetry .javaagent .extension .matcher .AgentElementMatchers .implementsInterface ;
1111import static io .opentelemetry .javaagent .instrumentation .spring .webmvc .v3_1 .SpringWebMvcSingletons .handlerInstrumenter ;
12- import static net .bytebuddy .matcher .ElementMatchers .isMethod ;
1312import static net .bytebuddy .matcher .ElementMatchers .isPublic ;
1413import static net .bytebuddy .matcher .ElementMatchers .nameStartsWith ;
1514import static net .bytebuddy .matcher .ElementMatchers .named ;
@@ -44,8 +43,7 @@ public ElementMatcher<TypeDescription> typeMatcher() {
4443 @ Override
4544 public void transform (TypeTransformer transformer ) {
4645 transformer .applyAdviceToMethod (
47- isMethod ()
48- .and (isPublic ())
46+ isPublic ()
4947 .and (nameStartsWith ("handle" ))
5048 .and (takesArgument (0 , named ("javax.servlet.http.HttpServletRequest" )))
5149 .and (takesArguments (3 )),
@@ -59,7 +57,7 @@ public static class AdviceScope {
5957 private final Context context ;
6058 private final Scope scope ;
6159
62- public AdviceScope (Context context , Scope scope ) {
60+ private AdviceScope (Context context , Scope scope ) {
6361 this .context = context ;
6462 this .scope = scope ;
6563 }
Original file line number Diff line number Diff line change 1212public class SpringWebMvcSingletons {
1313 private static final String INSTRUMENTATION_NAME = "io.opentelemetry.spring-webmvc-3.1" ;
1414
15- private static final Instrumenter <Object , Void > HANDLER_INSTRUMENTER ;
15+ private static final Instrumenter <Object , Void > handlerInstrumenter ;
1616
17- private static final Instrumenter <ModelAndView , Void > MODEL_AND_VIEW_INSTRUMENTER ;
17+ private static final Instrumenter <ModelAndView , Void > modelAndViewInstrumenter ;
1818
1919 static {
2020 SpringWebMvcInstrumenterFactory factory =
2121 new SpringWebMvcInstrumenterFactory (INSTRUMENTATION_NAME );
22- HANDLER_INSTRUMENTER = factory .createHandlerInstrumenter ();
23- MODEL_AND_VIEW_INSTRUMENTER = factory .createModelAndViewInstrumenter ();
22+ handlerInstrumenter = factory .createHandlerInstrumenter ();
23+ modelAndViewInstrumenter = factory .createModelAndViewInstrumenter ();
2424 }
2525
2626 public static Instrumenter <Object , Void > handlerInstrumenter () {
27- return HANDLER_INSTRUMENTER ;
27+ return handlerInstrumenter ;
2828 }
2929
3030 public static Instrumenter <ModelAndView , Void > modelAndViewInstrumenter () {
31- return MODEL_AND_VIEW_INSTRUMENTER ;
31+ return modelAndViewInstrumenter ;
3232 }
3333
3434 private SpringWebMvcSingletons () {}
You can’t perform that action at this time.
0 commit comments