DX Application Performance Management

Expand all | Collapse all

Instrumenting an inherited class with both private and implemented methods

  • 1.  Instrumenting an inherited class with both private and implemented methods

    Posted 10-30-2015 04:44 PM

    I have an issue with instrumented a class that has an inherited method and has private methods of its own. Either I can get the inherited method working OR the private methods but not both.So if I have abstract ClassA and ClassB extends ClassA and uses inherited method one. ClassB also has methods two, three and four.

     

    Abstract ClassA

    one()

    ClassB() - extends ClassA

    one()

    two()

    three()

    four()

     

    For example, if I use something like

     

    TraceOneMethodIfInherits: ClassA one BackendMarker

    TraceOneMethodOfClass: ClassB two BackendMarker

    TraceOneMethodOfClass: ClassB thee BackendMarker

    TraceOneMethodOfClass: ClassB four BackendMarker

     

    No matter what directives I use, I can only see metrics for method one() in ClassB or methods two(), three() and four() in ClassB. But not all 4 methods in ClassB.

     

    Thanks,

     

    Mike



  • 2.  Re: Instrumenting an inherited class with both private and implemented methods

    Posted 10-30-2015 06:34 PM

    Hi Mike,

    What you described should normally work, can you attach Autoprobe logs and provide real class names to cross check ?

     

    Regards,

    Kulbir.



  • 3.  Re: Instrumenting an inherited class with both private and implemented methods

    Posted 11-03-2015 01:29 PM

    I can't provide real class names. I will substitute.

     

    Processing class com/test/ClassA

    Processing class com/test/ClassB

            methodOne: 0                    inserted method tracer object allocation: com/wily/introscope/agent/trace/BackendTracer

            methodTwo: 0                  inserted method tracer object allocation: com/wily/introscope/agent/trace/BackendTracer

            methodThree: 0      inserted method tracer object allocation: com/wily/introscope/agent/trace/BackendTracer

            methodFour: 0                    inserted method tracer object allocation: com/wily/introscope/agent/trace/BackendTracer

            methodFive: 0                      inserted method tracer object allocation: com/wily/introscope/agent/trace/BackendTracer

            methodSix: 0        inserted method tracer object allocation: com/wily/introscope/agent/trace/BackendTracer

            methodOne: 0                    inserted method tracer object allocation: com/wily/introscope/agent/trace/BackendTracer

            methodSix: 0        inserted method tracer object allocation: com/wily/introscope/agent/trace/BackendTracer

     

     

    package com.test;

    public abstract class ClassA<A extends Result, B extends Query> {

       

        protected abstract QueryResults<A> methodOne(B query,

                @ModelAttribute("model") Model model) throws Exception;

       

        protected void methodSix(B query) throws Exception {

              // snip

            }

    }

     

     

    package com.test;

    @Service

    public class ClassB extends ClassA<Result, Query> {

     

        @Override

        public QueryResults<Result> methodOne(Query query,

                @ModelAttribute("model") Model model) throws Exception {

              // snip

        }

     

        private List<> methodTwo()

              // snip

        }

       

        private List<> methodThree()

              // snip

        }

     

        private List<> methodFour()

              // snip

        }

     

        private List<> methodFive()

              // snip

        }

     

        @Override

        protected void methodSix(Query query) throws Exception {

            // snip

            }

     

        }

     

    }



  • 4.  Re: Instrumenting an inherited class with both private and implemented methods

    Posted 11-03-2015 02:00 PM

    Hi Mike,

    As far as directives are concerned they seem to be working fine as we can clearly see all required methods being instrumented in class B.

    However at runtime metrics would only be generated if the class\method is actually invoked, are you sure all 4 methods are actually invoked when you don't see required metrics ?

    If yes then hard to explain the behavior described and I would recommend opening a support issue so we can review further.

     

    Regards,

    Kulbir.



  • 5.  Re: Instrumenting an inherited class with both private and implemented methods

    Posted 11-03-2015 03:38 PM

    Yes, we run the same test and all methods are hit during the test. If we shut of the instrumentation for methodOne (the inherited method), the other instrumentation works. And vice-versa. ugh!

     

    I wonder if the Spring annotation in the method signature is messing something up?

     

    Mike