DX Application Performance Management

 View Only
  • 1.  Response time calculator

    Posted Nov 09, 2023 10:02 AM

    Hi

    I'm triying to generate new metric that contains a counter of metric with average response time> 3 seconds.

    I developed a calculator but i can´t see the metric, i think that i have a mistake when i call the metric average response time.


    function execute(metricData, javascriptResultSetHelper) {
        var AverageResponseTimes = [];

        for (var i = 0; i < metricData.length; i++) {
            var agent = metricData[i].agentName.processURL;
            var value = metricData[i].timeslicedValue.value;
            var frequency = metricData[i].frequency;
            var metricArray = metricData[i].agentMetric.attributeURL.split(":");
            var appName = metricArray[0].substring(metricArray[0].lastIndexOf("|") + 1);

            if (metricArray[1] == "Average Response Time (ms)") {
                AverageResponseTimes.push([appName, agent, metricArray[0], value, frequency]);
            }
        }

        var currentTime = new Date().getTime();


        // Iterate through the AverageResponseTimes array
        for (var a = 0; a < AverageResponseTimes.length; a++) {
            var responseTime = AverageResponseTimes[a][3];
           
            if (responseTime > 3000) {
                // If response time exceeds 3 seconds, create a new metric to store it
                var metricName = Average Response Time (ms)[a][1] + "|" + Average Response Time (ms)[a][2] + ":slowtrans";
                javascriptResultSetHelper.addMetric(metricName, responseTime, javascriptResultSetHelper.kLongAverage, Average Response Time (ms)[a][4]);
            }
        }

        return javascriptResultSetHelper;
    }

    function getAgentRegex() {
        return ".*\\|Tomcat\\|Tomcat\\ Agent.*";
    }

    function getMetricRegex() {
        return "Frontends\\|Apps\\|[^\\|]*:Average Response Time \\(ms\\)";
    }

    function getFrequency() {
        return 1 * Packages.com.wily.introscope.spec.metric.Frequency.kDefaultSystemFrequencyInSeconds;
    }

    function runOnMOM() {
        return true;
    }


  • 2.  RE: Response time calculator

    Broadcom Employee
    Posted Nov 10, 2023 07:41 PM
      |   view attached

    I'm going to assume that you're utilizing 10.8 APM on-premise. I'll comment about our SaaS solutions later or maybe in another response.

    Firstly, read the documentation here: https://techdocs.broadcom.com/us/en/ca-enterprise-software/it-operations-management/application-performance-management/10-8/administrating/manage-metric-data-by-using-management-modules/create-and-edit-calculators/use-javascript-calculators.html

    For testing, I recommend you download a copy of the Rhino JS Engine, which we use in the product: https://mozilla.github.io/rhino/. You can download the binaries compatible with your OS from the GitHub repository.

    Take a look at some of the examples I have here: https://github.com/htdavis/ca-apm-fieldpack-js-calcs. In particular, look at ArrayTest.js. You can do something similar using your ART example to make sure you're able to parse and get the results you want.

    When using logging on an EM, the output is dumped to the EM log, depending on where the calculator is running. We do recommend you output any of the calculators to their own logfiles, by using the methods outlined in the attached provided. This so you can run logging in debug mode without polluting the EM log.

    Logging is going to be the most useful tool you have when debugging. Make sure to output the contents of your variables in the execute function to validate during every step.



    ------------------------------
    Hiko Davis
    Solution Engineer
    IMS Division | Broadcom
    ------------------------------

    Attachment(s)



  • 3.  RE: Response time calculator

    Posted Nov 14, 2023 12:05 PM

    Thanks Haruhiko,

    I will test it with the information that you give me and i will post the results




  • 4.  RE: Response time calculator

    Broadcom Employee
    Posted Nov 10, 2023 07:53 PM

    If you are using DX APM SaaS on-premise, you may not have ready access to view logs, without contacting someone who has access to your container environment.

    If you are using our hosted solution, you will need to open a support ticket.

    Again, it's best to do the testing locally before uploading.



    ------------------------------
    Hiko Davis
    Solution Engineer
    IMS Division | Broadcom
    ------------------------------