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

Feature Idea: Synthetics GitHub Version Control

synthetics
feature-idea
innovation

#1

Hi,

I’ve been looking around on the forum to see if anyone had previously posted about synthetic script version control. In particularly a connection to GitHub or possibly even some in-house version control functionality.

Features could include:

  • Ability to select previous versions of a script.
  • See the author of a specific script.
  • View who last edited/updated the script.
  • Visibly see the changes they have made. (Highlighted code + initials?)
  • Space for posting a reason for any changes made.
  • Space for comments or notes.

This level of functionality would be a great addition to the synthetic script creation process as some scripts can become longer and more complex over time.

I found this topic posted back in 2014:

I was just wondering if anything has been implemented since then?

Thanks,
Rob.


New Relic edit

  • I want this, too
  • I have more info to share (reply below)
  • I have a solution for this

0 voters

We take feature ideas seriously and our product managers review every one when plotting their roadmaps. However, there is no guarantee this feature will be implemented. This post ensures the idea is put on the table and discussed though. So please vote and share your extra details with our team.


Synthetic API Test source control
Import & access custom javascript(.js) file in synthetics API test script
Are the monitor scripts under New Relic source control?
#2

Hey there, @rhalliwell!

Thank you for your detailed request. I have added a poll so others in the community can vote on this as well! :blush:


#3

POSSIBLE WORK AROUND…

This hasn’t been tested, however it was suggested that the VM module is used to allow functions to be called from an external synthetic script for example a gist.

You can use NodeJS vm module https://nodejs.org/api/vm.html

const vm = require(‘vm’);
const runner = { };
vm.createContext(runner);
var req = require(‘urllib-sync’).request;
var res = req(‘https://gist.githubusercontent.com/robhalli/c03e4fe370da9528898d85a0718cf6b2/raw/3667377b02175008eb425e8966722113df87faac/fbf.js’);
const code = res.data;
vm.runInContext(code, runner);

runner.FBTEST();

FOR THIS TO WORK…

This would mean that the VM module would need enabling on the next Scripted monitor version runtime environment being released. This would be a huge help and allow for a easy to implement version control work around.


#4

Hey @rhalliwell - Thanks so much for posting this potential solution here. This looks great!! I’ll go ahead and add a feature request internally to open up the VM module in a future release. :smiley:


#5

tried running above script, vm module not loaded exception is coming in synthetic api test script.
what should i do to run the above script?


#6

Hi Kinzal,

Currently the VM module isn’t enabled on New Relic synthetics, I’ve requested for it to be enabled and we will have to wait and see…

Until then try:

var req = require(‘urllib-sync’).request;
var res = req(‘insert script url here EG raw gist url’);
var monitorBody = new Function(’$browser’, res.data);

monitorBody($browser);

The above code runs your script from a remote location allowing you to have your own version control running in the back-end.

Hopefully this helps you in the mean time.

Thanks,
Rob.


#7

Thanks.

I am able to access the file but the data is in buffer format so not able to access the exact data of js file.
Eg.
var req = require(‘urllib-sync’).request;
var apiUrl = “test/api/url/”;
var res = req(‘https://gist.githubusercontent.com/Kinzal15/e42ac978fe0ab9e9671f3d75e314b3b2/raw/b614f6bbd2d201b9796e3dc4c141f0a70773fdad/testRunner.js’);

//prints data in buffer format
console.log(res.data)

//it prints entire js file in string form
console.log(res.data.baseUrl);

How will I acess the functions of js file now & execute it?


#8

Hi Kinzal,

The VM Module will allow you to access functions from within the external script. However it currently isn’t enabled meaning that the you cant currently access the functions. We will have to wait and see if it gets added. Sounds like its in the pipeline though.

Thanks,
Rob.


#9

@rhalliwell, @kinzal.ostwal - The VM module is definitely a feature request we have filed here internally :smiley: - I don’t know if that’s on the roadmap yet, and we certainly don’t have a timeline on that yet. our Synthetics team are currently focussed on getting a number of features ready for GA, and we’ll likely see some of the other, smaller features come after that.