TraceOneMethodWithParametersOfClass does not map parameter value

Document ID : KB000105806
Last Modified Date : 09/07/2018
Show Technical Document Details
Issue:
I implemented a PBD to map the values of a specific parameter of the classes of the application that we monitor, but for some methods the parameter is not mapped even generating tests calls. Instead, seeing the Introscope names with the configured index position: 

Example: 
User is offline 
Method: myMethod (int param1, int param2) 
Parameter configured in PBD: {1} 

Return on Introscope: 
Test -> 
myClass -> 
myMethod -> 
{1} -> 
Average Response Time (ms) 
Concurrent Invocations 
Errors Per Interval 
Responses Per Interval 
Stall Count 

Expected return: 
Test -> 
myClass -> 
myMethod -> 
ParamValue1 -> 
Average Response Time (ms) 
Concurrent Invocations 
Errors Per Interval 
Responses Per Interval 
Stall Count 
ParamValue2 -> 
Average Response Time (ms) 
Concurrent Invocations 
,
Environment:
All supported APM releases.
Cause:
Not putting the JNI signatures on the method to exactly match the method which has the parameter and not the one which does not have.  
Resolution:
Development found the problem and the solution.

This quick test works  

Three methods are defined:


public static void method(){      

        method("Invocation1");  

}  

public static void method(String s1){   

        method("Invocation2", "Invocation1");  

}  

public static void method(String s1, String s2){       

}  

   

Since we are putting only the first parameter and the overloaded method which does not have the parameter will resolve to placeholder itself.  

   
So to have exact result you need is to put the JNI signatures on the method to exactly match the method which has the parameter and not the one which does not have it.  

 
Additional Information:
From the links in additional /information:
https://communities.ca.com/docs/DOC-231151998-custom-instrumentation-with-ca-apm

https://communities.ca.com/docs/DOC-231152665-instrumentation-best-practices

Important Note:  If you are unclear about what string the parameter will be converted to, do not use it in the metric name.  

When creating a “WithParameters” Tracer in Introscope, you will use the JNI notation of the method signature. For instructions on writing this signature, see the JNI Signatures page. Certain tracers, like the custom ConditionalMethodTraceIncrementor tracer, require that the WithParameters and JNI notation be used.  Please refer to the "Tracer Types" page for more details.