• /
  • Log in
  • Free account

Synthetic monitoring best practices guide

New Relic's synthetic monitoring—powered by a Selenium-driven Chrome browser—allows you to monitor and test your apps and address issues before they affect your end users. Here are five tips to help you take immediate advantage of its full power.

1. Match your monitor type to monitoring need

Synthetic monitors are virtual browsers that measure the performance of your website, recording each check in detail. They also capture aggregate numbers for load time, uptime, and average download size, as well as an overview, detailed statistics for each page resource, and downtime incidents.

There are four types of synthetic monitors; the ones you deploy will depend on the things you want to monitor:

  • Ping monitors—to ensure that your site is accessible.
  • Simple browser monitors—to ensure end-user performance.
  • Scripted browsers—to ensure that particular resources are present.
  • API monitors—to ensure that your app server works as well as your website.

How to do it

  1. To add a monitor, go to one.newrelic.com > Synthetics (or one.eu.newrelic.com if you have an EU-based account) and click Create monitor. Specify monitor type, name, and URL.

  2. Optional: Add a validation string (available for ping and simple browser) or advanced options, which enable substring monitoring for the following types of response validation:

    • Verify SSL (for ping and simple browser). This option verifies the validity of the SSL certificate chain. It can be duplicated by running the following syntax:

      openssl s_client -servername {YOUR_HOSTNAME} -connect {YOUR_HOSTNAME}:443 -CApath /etc/ssl/certs > /dev/null
    • Bypass HEAD request (for ping). This option skips the default HEAD request and instead uses the GET verb with a ping check.

    • Redirect is Failure (for ping). If a redirect result occurs when Redirect is Failure is enabled, Synthetics categorizes it as a failure (rather than following the redirect and checking the resulting URL).

  3. Select the locations where you want your monitor to run.

  4. Choose a frequency to determine how often each location will run your monitor.

  5. Optional: Set up alert notifications.

  6. Select Create my monitor to confirm.

  7. Wait a few minutes; then from the Monitors index check your monitor.

2. View all monitors with the Monitors index page

Continuous application performance monitoring is essential to ensure that web services are in place, working correctly, and error-free. Synthetic monitoring provides this type of assurance by performing automated tests on your web application for each selected location—noting downtime instances (“violations”) and collecting aggregate numbers, results, and detailed statistics for each page resource.

Use the Monitors index page to get a high level view of this information, or select an individual monitor to view the Summary, for ping monitors, or Overview, for simple and scripted monitors, page and get a deeper insight into its performance over time.

How to view your monitors in the New Relic One:

3. View individual monitor results

It’s not enough to understand how your web apps are performing for your West Coast customers; you need to be able to view how they’re performing across the country and around the globe. By taking advantage of synthetic monitors and visiting your Results page, you can see how everything from development to production affects user experience. You can locate interesting results by sorting the list to identify slow, fast, or other unusual results. Or filter by location to understand how monitor performance varies with geography. (The “Network timings” graph below provides a snapshot of webpage performance over a given period.)

How to do it:

  1. Go to one.newrelic.com > Synthetics and, from the Monitors tab, select your monitor.
  2. Select Monitor > Results.
  3. Gain an up-to-the-minute view of the slowest page loads for every monitored location.

4. Understand the load-time impact of each resource

Visit the synthetics Resources page to see how each resource on your website—including CSS, JavaScript, images, HTML and more—is affecting your overall load. You can drill into detailed metrics collected at run time, locate performance information for time spent by third-party resources, and identify HTTP response codes for each resource.

How to do it:

  1. Go to one.newrelic.com > Synthetics and, from the Monitors drop-down menu, select your monitor.
  2. Select Monitor > Resources.

5. Configure and develop a scripted browser test

Using scripted browsers, you can build complex monitoring workflows using the Selenium JavaScript Webdriver bindings. For instance, you can log in to the application, navigate to a particular link, and wait for a page element to load and add an assertion.

How to do it:

  1. Go to one.newrelic.com > Synthetics.
  2. Choose your monitor type (for example, scripted browser).
  3. Enter the name and details of your monitor (for example, Sitename.com scripted browser)
  4. Select the locations from which you want your monitor to run (for example, Mumbai, Seoul, Columbus, and Montreal).
  5. Choose a frequency to determine how often each location will run your monitor (for example, five minutes).
  6. Set a notification method to alert your team when performance violations occur.
  7. You are now ready to write your script. (Below is an example of a script used to test the performance of a main navigation page.)
var assert = require('chai').assert;
// script-wide timeout for all wait and waitandfind functions (in ms)
var default_element_timeout = 190000; //3 mins
var default_pageload_timeout = 240000; //4 mins
var navlinks = ["css-locator-1", "css-locator-2"];
//sets element load timeout to 3 mins
$browser.manage().timeouts().implicitlyWait(default_element_timeout);
//sets page load timoeout to 4 mins
$browser.manage().timeouts().pageloadTimeout(default_pageload_timeout);
//test all the main nav page performances
$browser.get("http://www.sitename.com").then(function() {
return $browser.findelement($driver.by.classname("site-theme-example"));
}).then(function() {
//verifies the nav list has loaded
return $browser.findelement($driver.by.classname("site-nav-list-example"));
}).then(function() {
//loops through the navlinks array
navlinks.foreach(function(val, i, arr) {
//finds and navigates to each navlink page
return $browser.findelement($driver.by.classname(navlinks[i])).click().then(function() {
//verifies that the nav list loaded before moving on
return $browser.findelement($driver.by.classname("site-nav-list-example")).then(function() {
//verifies that the page logo footer at bottom of page has loaded
return $browser.findelement($driver.by.classname("site-footer-logo"));
});
});
});
});
Create issueEdit page
Copyright © 2022 New Relic Inc.