javascript – Invalid values getting synced via new relic custom metrics in node js

I am making use of new relic custom metric node Js in the new relic.

To record metric I am using newrelic.recordMetric('SparshNish1/SparshNishGauge', 96.26);

To increment counter I am using newrelic.incrementMetric('SparshNish1/SparshNishNameCounter', 93);

The record metric response I am getting in the new Relic is different.

"events": [
        {
          "appId": 1093352574,
          "appName": "Testing",
          "endTimestamp": 1646821613000,
          "entity.guid": "MzQzNDM5MHxBUE18QVBQTElDQVRJT058MTA5MzM1MjU3NA",
          "entityGuid": "MzQzNDM5MHxBUE18QVBQTElDQVRJT058MTA5MzM1MjU3NA",
          "language": "nodejs",
          "metricName": "newrelic.timeslice.value",
          "metricTimesliceName": "Custom/SparshNish1/SparshNishGauge",
          "newrelic.timeslice.value": {
            "type": "timeslice",
            "count": 1,
            "total": 96.26000213623047,
            "totalExclusive": 96.26000213623047,
            "min": 96.26000213623047,
            "max": 96.26000213623047,
            "sumOfSquares": 9265.9873046875
          },
          "scope": "",
          "timestamp": 1646821560000
        },
        {
          "appId": 1093352574,
          "appName": "Testing",
          "endTimestamp": 1646821560000,
          "entity.guid": "MzQzNDM5MHxBUE18QVBQTElDQVRJT058MTA5MzM1MjU3NA",
          "entityGuid": "MzQzNDM5MHxBUE18QVBQTElDQVRJT058MTA5MzM1MjU3NA",
          "language": "nodejs",
          "metricName": "newrelic.timeslice.value",
          "metricTimesliceName": "Custom/SparshNish1/SparshNishGauge",
          "newrelic.timeslice.value": {
            "type": "timeslice",
            "count": 0,
            "total": 0,
            "totalExclusive": 0,
            "min": 96.26000213623047,
            "max": 96.26000213623047,
            "sumOfSquares": 0
          },
          "scope": "",
          "timestamp": 1646821554000
        }
      ]

Also the counter metric response I am getting in the new relic is also different.

      "events": [
        {
          "appId": 1093352574,
          "appName": "Testing",
          "endTimestamp": 1646821613000,
          "entity.guid": "MzQzNDM5MHxBUE18QVBQTElDQVRJT058MTA5MzM1MjU3NA",
          "entityGuid": "MzQzNDM5MHxBUE18QVBQTElDQVRJT058MTA5MzM1MjU3NA",
          "language": "nodejs",
          "metricName": "newrelic.timeslice.value",
          "metricTimesliceName": "Custom/SparshNish1/SparshNishNameCounter",
          "newrelic.timeslice.value": {
            "type": "timeslice",
            "count": 84,
            "total": 0,
            "totalExclusive": 0,
            "min": 0,
            "max": 0,
            "sumOfSquares": 0
          },
          "scope": "",
          "timestamp": 1646821560000
        },
        {
          "appId": 1093352574,
          "appName": "Testing",
          "endTimestamp": 1646821560000,
          "entity.guid": "MzQzNDM5MHxBUE18QVBQTElDQVRJT058MTA5MzM1MjU3NA",
          "entityGuid": "MzQzNDM5MHxBUE18QVBQTElDQVRJT058MTA5MzM1MjU3NA",
          "language": "nodejs",
          "metricName": "newrelic.timeslice.value",
          "metricTimesliceName": "Custom/SparshNish1/SparshNishNameCounter",
          "newrelic.timeslice.value": {
            "type": "timeslice",
            "count": 9,
            "total": 0,
            "totalExclusive": 0,
            "min": 0,
            "max": 0,
            "sumOfSquares": 0
          },
          "scope": "",
          "timestamp": 1646821554000
        }
      ]

As you can see I am trying to sync amount 93 using new relic counter, but it is coming as 2 events of amount 84 and 9.

Also as you can see I am trying to sync amount 96.26 using new relic record metric, but it is also coming in 2 events.

Read more here: Source link