How to process summary metric data and display charts

We are publishing summary type metrics for http.server.request
As part of summary type we are having 4 attributes-

  1. Count - > request count
  2. Max -> Response Time
  3. Min -> Response Time
  4. Sum. -> Response Time

Now if i need to create charts for -

  1. Average Request Count
  2. Average Response Time (Latency)
  3. Max Response Time (Latency)
  4. Max Request Count

Please let me know how i can do that using math functions.

Sorry i need Total Request Count also.

@nitin.Bohra Thank you for being so thorough with your request. I’m going to ping @stefan_garnham and @philweber to see if either of them have suggestions for you. :slight_smile:

Hi, @nitin.bohra: Are you saying that you are creating a custom event called Summary, and it has attributes named count, sum, min, and max? If so, that may be a problem, because count, sum, min, and max are the names of NRQL functions.

1 Like

Adding on to the point Phil mentioned on reserved names, I think you may have an issue in how you are sending the data, based on your screenshot it appears as though you are shipping the http.server.requests attribute as a JSON object

image

You will not be able to write sub-queries in NRQL to pull out data from the JSON object here. You may need to flatten that data into separate attributes on your side before shipping those to New Relic.

1 Like

You will not be able to write sub-queries in NRQL to pull out data from the JSON object here. You may need to flatten that data into separate attributes on your side before shipping those to New Relic.

What does this mean?

I am using Micrometer and the NR Relic Micrometer integration with Springboot and it is what is shipping metrics like this.

Are you saying that the New Relic Micrometer integration is broken and doesn’t send Time based metrics properly?

I also need to get the sum so I can make latency charts.

{
      "account": "None",
      "applicationName": "clouddriver",
      "armoryAppVersion": "2.21.0-snapshot.20200616060900.uncommitted.916e8ee",
      "baseUnit": "milliseconds",
      "cause": "None",
      "collector.name": "micrometer-registry-newrelic",
      "collector.version": "0.5.0",
      "controller": "PrometheusScrapeController",
      "controller.invocations": {
        "type": "summary",
        "count": 33,
        "sum": 72.189644,
        "min": null,
        "max": 2.47281
      },
      "customerEnvName": "fieldju-local",
      "customerName": "armory",
      "endTimestamp": 1592601631422,
      "instrumentation.provider": "micrometer",
      "lib": "armory-observability-plugin",
      "libVersion": "v1.0.0-SNAPSHOT",
      "method": "scrape",
      "metricName": "controller.invocations",
      "newrelic.source": "metricAPI",
      "ossAppVersion": "6.9.2-20200606020017",
      "region": "None",
      "spinnakerRelease": "1.20.5",
      "status": "2xx",
      "statusCode": "200",
      "success": "true",
      "timestamp": 1592601613053
    }

This is how the New Relic Micrometer integration is sending the data.

I am trying to figure out how to start making charts that show the average latency / time

[EDIT 1]

Okay, I think I have it figured out.

SELECT (sum(controller.invocations)/count(controller.invocations)) 
FROM Metric 
WHERE metricName = 'controller.invocations' 
    AND statistic != 'percentile' 
SINCE 30 minutes ago 
FACET controller, method 
TIMESERIES AUTO 

This is what I had to do and I was able to create a chart with the summary data.

I would say that @RyanVeitch’s reponse from May 13, is not accurate.

It appears you can access Summary attribute via treating each attribute as a NRQL function.

${attribute}(metric_name_that_is_a_summery)

[Edit 2]

It appears that you can simplify this query NRQL will let you do the following

SELECT average(controller.invocations)
FROM Metric 
WHERE metricName = 'controller.invocations' 
    AND statistic != 'percentile' 
SINCE 30 minutes ago 
FACET controller, method 
TIMESERIES AUTO
1 Like

Thanks for digging in to that @justin.field - you’re right. It seems I was wrong…

Thanks for the correction. Querying metric data in NRQL is a relatively new capability & clearly I need to brush up on that knowledge!