cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

This product reached the end of support date on March 31, 2021.

Unable to Retrieve/Instrument Specific Method of Argument with Method Sensor Rules Using Accessors

victor_segovia
Inactive

We have a specific class "ConsultasGestionVentas" which has a certain method "doPost" ( protected void doPost(HttpServletRequest request, HttpServletResponse response) ), as shown, the arguments passed to the method belong to the "HttpServletRequest" and "HttpServletResponse" standard classes (servlet), we need to instrument this method in such a way that we can retrieve a specific method of the “request” argument (for Business Transactions purposes); as commonly know, "HttpServletResponse" inherent from "javax.servlet.ServletRequest" the "getParameter" method ( getParameter(java.lang.String name) ) which is the argument we really need to retrieve; we have placed a Method Sensor Rule for "doPost" and we are using as Accessor "getParameter()" for the "HttpServletRequest request" argument in order to achieve this, but we are getting a "accessor failed" result within the PurePath, we do not know what are we doing wrong, any directions will be greatly appreciated.

2 REPLIES 2

dave_mauney
Dynatrace Champion
Dynatrace Champion

Hi Victor,

First, I believe the method is "getParameter(java.lang.String name)", which will not work since we allow no arguments on getters used for deep object access.

Second, I believe the easier way to go about this is to capture the specific Request Parameter using the Servlets Sensor Configuration Properties. To do that, edit your System Profiile, open the agent group that is appropriate, select Sensor Configuration. select the "Properties..." link for the Servlets sensor, use the bottom "Add" button and use source "Request Parameter" and set "Attribute" to the name of the parameter you want.

After you get this working, you will be able to right click on the Servlet node in the PurePath tree (doPost in your example) and see the parameter using "Details".

After you can see it in Details, you can create a measure, and go from there as needed.

HTH,

dave

victor_segovia
Inactive

Hi Dave,


Your recommendation was pretty useful and now we are retrieving the desired parameter within our PurePaths, thanks.