Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

How to add static value in a table for NRQL query involving facet

nrql
insights
synthetics-script

#1

Requirement : Synthetic monitoring script was developed and scheduled to run across 5 different locations. We would like to see the load times of any page in a table and provide a comparison against the expected load time for that location. For example, lets say a website is accessed from 5 different locations, the expected load time from location1 could be 5 seconds, while from location2 could be 7 seconds, location3 could be 2 seconds, location4 could be 4 seconds, location5 could be 10 seconds.

How can we achieve this in NRQL (refer to the attachment )Capture ?

Please refer to dashboard which is currently worked upon
https://one.newrelic.com/launcher/dashboards.launcher#launcher=eyJ0aW1lUmFuZ2UiOnsiYmVnaW5fdGltZSI6bnVsbCwiZW5kX3RpbWUiOm51bGwsImR1cmF0aW9uIjo0MzIwMDAwMH0sInByZXZSYW5nZSI6WzE1Nzc5ODQ2NzUyMzEuMTU1OCwxNTc4MTE5NDg1MjgxLjQwN119&pane=eyJuZXJkbGV0SWQiOiJkYXNoYm9hcmRzLmRhc2hib2FyZCIsImVudGl0eUlkIjoiTWpBNU9UTTFOM3hXU1ZwOFJFRlRTRUpQUVZKRWZERXdOek01T1RRIiwiaXNUZW1wbGF0ZUVtcHR5IjpmYWxzZX0=


#2

Hi, @VithalKumar.Akunuri1: In your script, you can create an array containing the expected load time for each location:

const expectedLoadTimes = {
  'location1': 5,
  'location2': 7,
  'location3': 2,
  'location4': 4,
  'location5': 10
}

Then use $env.LOCATION to get the location of the currently-running monitor, and add the expected load time as a custom attribute:

var currentLocation = $env.LOCATION;
$util.insights.set('expectedLoadTime', expectedLoadTimes[currentLocation]);

#3

Thanks @philweber , it really helped.