DX Application Performance Management

Expand all | Collapse all

Putting method param/arg into a metric - PBD

Jump to Best Answer
  • 1.  Putting method param/arg into a metric - PBD

    Posted 06-10-2015 04:15 PM

    I would like to show in the investigator the value of a parameter passed in a method. For example:

     

     

    public void doSomething (String str, int numberInt) {

    ....

    ....

    ...

    }

     

     

    I need to show the sum of the value of the parameter numberInt as follows:

     

     

    Agent -> MetricResourcce -> Method: doSomethingValue

     

     

     

    I did some testing with TraceOneMethodWithParametersOfClass, but the result was not expected.

     

     

    My question is similar to described the link below, but the last solution by Jack Butler did not work with Integer values.

     

    https://communities.ca.com/message/111844182#111844182



  • 2.  Re: Putting method param/arg into a metric - PBD

    Posted 06-10-2015 04:28 PM

    You need to take a look at our wiki page on how about PBD creation and using signatures.

    You can find it at http://bit.ly/caapm_dev.

     

    You will want to use one of the "WithParameters" directives in your PBD.



  • 3.  Re: Putting method param/arg into a metric - PBD

    Posted 06-10-2015 05:29 PM

    Hello Davis, I used the following syntax in PBD:

     

    TraceOneMethodWithParametersOfClass: br.com.interadapt.testemetodo.ExecutaMetodo testMetodo(Ljava/lang/String;I)V IntegerSecondParameterValueTracer "OneMethodOfClass|{classname}|{method}:{1}"

     

    teste.PNG

     

     

     

    I would like the parameter values appear in a chart and not one metric per invocation.

     

    IntegerSecondParameterValueTracer  is a custom tracer created by Jack Butler, I wonder if you can do this with the default tracers or you must use a customization.

     

    Thanks for help



  • 4.  Re: Putting method param/arg into a metric - PBD

    Posted 06-10-2015 05:53 PM

    The format is:

     

    TraceOneMethodWithParametersOfClass: myClass myMethod <tracer> "myNode|{classname}|{method}|{x}"

     

    where x = the index of the method parameter. The index starts at 0.

     

    For the tracer, I recommend you start with BlamePointTracer, which gives you the standard 5 Blame metrics. To increment the Errors Per Interval, you'll need to copy each instance where you use BlamePointTracer and replace it ExceptionErrorReporter, then end with "Errors Per Interval". Here is an example:

     

    TraceOneMethodWithParametersOfClass: myClass myMethod ExceptionErrorReporter "myNode|{classname}|{method}|{x}:Errors Per Interval"



  • 5.  Re: Putting method param/arg into a metric - PBD

    Posted 06-10-2015 06:35 PM

    Hello Davis, I used exactly the format you said and it worked, but the result was not expected. A metric is generated for each parameter value:

     

    teste.PNG

     

     

    I need a chart to be generated with these values as datapoints.

     

     

    I believe we have to create some type of customization to display this information.

     

     

    I'm looking for APM-9X.bundles.zip file (APM 9.7.1 or 9.7.0) to use the APM Studio, but I can not find on the site CA. Can you pass me the link or send it to my email?

     

    plinioaugusto01@gmail.com

     

     

    I appreciate your help



  • 6.  Re: Putting method param/arg into a metric - PBD
    Best Answer

    Posted 06-10-2015 06:53 PM

    Just create your own bundle by following the directions on APM Studio website.

     

    The parameter substitution should have picked up your values to use as part of your metric name.

     

    Are you using a custom nameformatter? What is IntegerSecondParameterValueTracer? From your previous example, your method only has one parameter, so your x value should be 0.

     

    TraceOneMethodWithParametersOfClass: br.com.interadapt.testemetodo.ExecutaMetodo testMetodo BlamePointTracer "myNode|{classname}|{method}|{0}"

    TraceOneMethodWithParametersOfClass: br.com.interadapt.testemetodo.ExecutaMetodo testMetodo ExceptionErrorReporter "myNode|{classname}|{method}|{0}:Errors Per Interval"



  • 7.  Re: Putting method param/arg into a metric - PBD

    Posted 06-10-2015 07:30 PM

    If, in fact, you are using a custom nameformatter, you must use the PBD provided with the tracer and cannot be modified.

    If you need changes to the nameformatter, you have to speak to the person who wrote it, else you'll have to get the source code.



  • 8.  Re: Putting method param/arg into a metric - PBD

    Posted 06-15-2015 05:05 AM

    Hello plinioMoreira4451798,

     

    As outlined by Haruhiko, you'll need to use a custom tracer to extract the sum of the second parameter as a value into Introscope.

    Is the extension written by Jack Butler working for you or do you need additional assistance? Please let us know.

     

    Kind regards,

    Stefan