AnsweredAssumed Answered

trace different return value of one method use custom trace

Question asked by Zhangyanjun on Jul 4, 2017
Latest reply on Jul 4, 2017 by Zhangyanjun

Our customer want to monitor their business performance rather than application performance. The business performance means their core business codes such as package.businessclass1.businessmethod1. The businessmethod1 has 4 parameters and one string type return value.the method's definition is string businessmethod(string string1,string string2,int int3,int int4).Each value of these parameters means one kind of customer's business and each value of return value means one status of one business.The customer want to know the performance of each business. So I create the custom pbd to trace these businesses. I use the directive TraceOneMethodWithParametersOfClass in the custom pbd because different value of parameter means different business. The syntax in the pbd is "TraceOneMethodWithParameterOfClass:businessclass1 businessmethod1(Ljava/lang/String;Ljava/lang/String;ii)Ljava/lang/String BlamePointTracerDifferentInstances "Businesses|businessname|{businessmethod1}_{0}_{1}_{2}_{3}". This custom pbd will generate many different metrics that match every business of customer.
{0}{1}{2}{3} means different value of the four parameters of businessmethod1.

Now our customer want to distinguish the different status of business from the business metrics. The different return value of businessmethod1 means different status of business such as success or fail with reason1 or fail with reason2 and so on. So I must trace the return value of businessmethod1 and generate the metrics base on different business and different status.
Can I gain these metrics above through extend the custom pbd from "TraceOneMethodWithParameterOfClass:businessclass1 businessmethod1(Ljava/lang/String;Ljava/lang/String;ii)Ljava/lang/String BlamePointTracerDifferentInstances "Businesses|businessname|{businessmethod1}_{0}_{1}_{2}_{3}" to "TraceOneMethodWithParameterOfClass:businessclass1 businessmethod1(Ljava/lang/String;Ljava/lang/String;ii)Ljava/lang/String BlamePointTracerDifferentInstances "Businesses|businessname|{businessmethod1}_{0}_{1}_{2}_{3}_{4}". I think the {4} means the return value and APM can generate different metrics according different value of {4}. Is correct this?

If not then how can I trace the different return value of a method in CA APM?