DX Application Performance Management

Expand all | Collapse all

My js doesn't show metrics

  • 1.  My js doesn't show metrics

    Posted 01-15-2018 03:50 PM

    And I don't know why perhaps you be able to help me.

    I want to add a new metric, I have this structure



    And I need to add a % metric calculating between Max Size and Current Size


    This is my code


    function execute(metricData,javascriptResultSetHelper) {

    var total;
    var usado;
    var frequency = Packages.com.wily.introscope.spec.metric.Frequency.getFrequencyInSeconds(15);
    var agent;
    var metric;
    var nombreMetrica="";
    var rawvalue =0;

    for(i=0; i < metricData.length; i++) {

    metric = metricData[i].agentMetric.attributeURL;
    agent = metricData[i].agentName.processURL;
    rawvalue = metricData[i].timeslicedValue.value;
    frequency = metricData[i].frequency;
    var isAbsent = metricData[i].timeslicedValue.dataIsAbsent();

    if (metric.indexOf("Current")> -1) {
    usado = rawvalue;
    if (metric.indexOf("Max")> -1){
    total = rawvalue;


    var result= (usado / total) * 100;
    var valorRta = Math.round(result);
    var metrica1=agent + "|WebMethods|Adapter Connection Pools|DS_BPM1:Porcentaje Uso %";
    (metrica1,valorRta,Packages.com.wily.introscope.spec.metric.MetricTypes.kLongFluctuatingCounter,frequency );


    // return the result set
    return javascriptResultSetHelper;

    function getAgentRegex() {
    return "(.*)\|BPM\-IS\-DEV\-v97\|IntegrationServerAgent\|";

    function getMetricRegex() {
    return "WebMethods\|Adapter Connection Pools\|DS_BPM1:(.*)";


    // must return a multiple of default system frequency (currently 15 seconds)
    function getFrequency() {
    return 1 * Packages.com.wily.introscope.spec.metric.Frequency.kDefaultSystemFrequencyInSeconds;

    //Return false if the script should not run on the MOM.
    //Scripts that create metrics on agents other than the Custom Metric Agent
    //should not run on the MOM because the agents exist only in the Collectors.
    //Default is true.
    function runOnMOM()
    return false;


    It doesn't make errors but don't show metrics too. Actually metricData.length = 0. Do you see some error or mistake in this code?



  • 2.  Re: My js doesn't show metrics

    Posted 01-15-2018 04:25 PM

    Hi Osvaldo,

    I have converted to a discussion since more of a customization related question.

    Can anyone help Osvaldo with this?



  • 3.  Re: My js doesn't show metrics

    Posted 01-15-2018 04:59 PM

    You might want to download and take a look at some of my calculators to see how to grab metrics for comparison: GitHub - htdavis/ca-apm-fieldpack-js-calcs: JavaScript calculators 

  • 4.  Re: My js doesn't show metrics

    Posted 01-15-2018 05:01 PM

    You should add debug logging to see what the problem is.

    You can also make it a little easier by outputting your JS log data to a different file. Details available here: JavaScript Calculators