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

Synthetics Script Questions


#1

Hello, @RyanVeitch
I need to monitor some services API.
Could I put these http requests in one Synthetics Script?
Cause they all use one OAuth2.0 token. Request token every service is not necessary.
If put in one Script, will it run all requests and alert each issue?
Thanks.


made this topic public #2

#3

Hey @Spark_H_Zhang -

You can definitely chain your API calls into one synthetics monitor.

Note that the monitors have a max timeout of 180s, so your chained calls should take less time than this.

Another note is that you should keep your OAuth token in a Secure Credential that you can reference in the API Script.


As for alerting per issue, you’ll need to add in some handling to your script, as typically the first problem would cause the monitor to fail, and the remaining requests will not be run.

So - an idea could be to add handling that sets a custom Insights attribute if an issue is found, a different attribute per API url you hit, and then set up some NRQL alerting based on these attributes such that you get notified based on the specific issue that comes in. While your script will continue to succeed thanks to the handling you add in.