DX Application Performance Management

Expand all | Collapse all

TraceOneMethodWithParametersOfClass when parameter is an Object and I am interested in a String property of the Object.

Jump to Best Answer
  • 1.  TraceOneMethodWithParametersOfClass when parameter is an Object and I am interested in a String property of the Object.

    Posted 06-23-2020 11:13 AM
    I have a custom tracer capturing the Id parameter for the method:
    public int com.example.ClientWithResponseHandler.get(String Id) using:

    TraceOneMethodWithParametersOfClass: com.example.ClientWithResponseHandler get(Ljava/lang/String;)I BlamePointTracer "Code|ClientWithResponseHandler|{0}"

    and itis working Ok.

    I have the another method where the parameter is of type com.example.DataContainer that has a property called Id (String Type)
    public int com.example.ClientWithResponseHandler.getDC(DataContriner dc)

    I would like to do the same with this method as the one above but using the property dc.Id (DataContainer.Id property)

    Can someone point me on how to accomplish this?

    Muneer


  • 2.  RE: TraceOneMethodWithParametersOfClass when parameter is an Object and I am interested in a String property of the Object.

    Broadcom Employee
    Posted 06-23-2020 02:54 PM
    Please review the following and see if this helps.

    https://ca-broadcom.wolkenservicedesk.com/external/article?articleId=105806

    https://community.broadcom.com/enterprisesoftware/search?s=Tracer%20Types&l=1


  • 3.  RE: TraceOneMethodWithParametersOfClass when parameter is an Object and I am interested in a String property of the Object.

    Posted 06-24-2020 11:32 AM
    Thanks Amir,  Those links did not help in my problem.   I am able to get to the parameters .  But I am not sure how to reference a property or method of the parameter.

    For example (I am sure this is not valid)

    TraceOneMethodWithParametersOfClass: com.example.ClientWithResponseHandler get(Ljava/util/Hashtable<Ljava/lang/String;Ljava/lang/String;>;)I BlamePointTracer "Code|ClientWithResponseHandler|{0}.get('url')"

    I am trying to use to the value of the key "url: from the passed Hashtable parameter.  i.e. Hashtable.get('url')

    Thanks


  • 4.  RE: TraceOneMethodWithParametersOfClass when parameter is an Object and I am interested in a String property of the Object.
    Best Answer

    Broadcom Employee
    Posted 06-25-2020 05:16 AM
    Hi Muneer,

    In this cases you need to create your own NameFormatter.

    By default, there is NameFormatter that replaces placeholders like {N} (method parameter in position N), {classname}, {method}, etc

    The object behind this placeholders must support the method toString().

    When you need to call additional methods on the objects to get the value of interest, the only way is using a custom NameFormatter. 

    A NameFormatter is a Java class associated to a Tracer and called after it to format the metric path. NameFormatters use Java refection (java.lang.reflect).

    A NameFormatter class must be package in a jar file with a proper MANIFEST file.

    Regards


  • 5.  RE: TraceOneMethodWithParametersOfClass when parameter is an Object and I am interested in a String property of the Object.

    Posted 06-26-2020 06:31 AM
    Thank you Jose,  I am trying to find documentation, references or examples on writing my own NameFormatter with no luck! Can you point me in the right direction please?

    Regards,



  • 6.  RE: TraceOneMethodWithParametersOfClass when parameter is an Object and I am interested in a String property of the Object.

    Broadcom Employee
    Posted 07-01-2020 03:33 AM
    Hi Muneer,

    unfortunately, there isn't documentation to share.

    Regards