New Relic Synthetics Manager

New Relic Synthetics is a powerful tool for monitoring that your applications are working correctly. Synthetics provide several different ways to check your applications’ health including Ping, Browser, Script API and Scripted Browser. One of the most interesting type of synthetic is the Scripted Browser Synthetic, which lets you write javascript code to mimic a user’s interaction with the system. These are run at specified intervals and can be configured to alert you if they fail. At Yodle, we have been moving some of our production smoke tests to New Relic Scripted Browser Synthetics to ensure they are running frequently and catching issues in production.

Pain Points

There are a couple of pain points when working with Scripted Browser Synthetics. First, it would be really nice to be able to run the same synthetic that New Relic is running on my local machine. Being able to run the synthetic locally allows debugging and stepping through the javascript code. This is very helpful when debugging a failed synthetic or developing a new one.

It would also be nice to have a history of all of the changes to a synthetic. As production code changes and gets new features, the synthetic tests will also evolve and change. When debugging synthetic tests, it may be useful to look at the history of the tests and see who has recently made changes to it.

Introducing New Relic Synthetics Manager

To remove these problems, we built and open sourced a New Relic Synthetics Manager tool. The tool provides a small javascript library that allows running Scripted Browser Synthetics on a local machine. It also contains a command line tool to manage the creation and updating of Scripted Browser Synthetics. This tool makes it easy to store your Scripted Browser Synthetics under an SCM and use a Continuous Delivery tool to keep them up to date.

Using it in a delivery pipeline

We put our production smoke tests that had been converted into synthetics into a git repository. Then, thanks to our new tool, we were able to write a simple script that we put in our CD system that updates all changed synthetics on every change to master (The script can be downloaded here)

Other features

The command line tool also can be used to create new synthetics (create the synthetic in New Relic and create a local file for the synthetic code) and import existing synthetics from New Relic into your SCM.

For more information, check out the github repository: https://github.com/yodle/new-relic-synthetics-manager


Originally published at www.yodletechblog.com on January 4, 2017.