Synthetics
Synthetic monitoring allows testing the availability and response time of a service from the perspective of an end user, including any latencies introduced by edge caching and API gateways. They're a good means of ensuring that a service is meeting performance targets. Synthetics Monitoring: Are You Cyber Monday Ready? offers a good introduction to the service.
Types
New Relic provides four types of synthetic monitors:
- Ping tests (
SIMPLE
) simply execute aHEAD
(orGET
) request for a given URL and check the response status, and optionally look a string in the response body. Redirects can be considered failures if desired. They can be used to verify the validity of an SSL certificate. - Simple Browser (
BROWSER
) tests execute in Chrome, thus also fetch assets embedded in the response body and providing a more complete approximation of an end-user's experience. - Scripted Browser (
SCRIPT_BROWSWER
) allows you to execute a more complex test against a Chrome browser instance via Selenium WebDriver, allowing you to simulate a series of requests. - API Test (
SCRIPT_API
) execute tests against API endpoints, also against Chrome via WebDriver.
In all cases you're able to select the regions in which the synthetics clients should be located and a schedule with frequency between 1 minute and 1 day.
API
The API can be briefly summarised as:
$browser
, which exposes methods for driving the browser and working with the response data:- These methods return promises, which can be chained to perform requests in series:
get(url: string)
findElement()
- These methods return promises, which can be chained to perform requests in series:
$driver
By
:className(className: string)
id(id: string)
name(name: string)
xpath(selector: string)
linkText(text: string)
partialLinkText(text: string)
$env
$secure