Last active
June 3, 2019 20:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Apps Script code snippet based on GCPping.com | |
@author Ivan Kutil | |
*/ | |
var URLS = { | |
"asia-east1": "http://104.155.201.52/ping", | |
"asia-east2": "http://35.220.162.209/ping", | |
"asia-northeast1": "http://104.198.86.148/ping", | |
"asia-south1": "http://35.200.186.152/ping", | |
"asia-southeast1": "http://35.185.179.198/ping", | |
"australia-southeast1": "http://35.189.6.113/ping", | |
"europe-north1": "http://35.228.170.201/ping", | |
"europe-west1": "http://104.199.82.109/ping", | |
"europe-west2": "http://35.189.67.146/ping", | |
"europe-west3": "http://35.198.78.172/ping", | |
"europe-west4": "http://35.204.93.82/ping", | |
"europe-west6": "http://34.65.3.254/ping", | |
"global": "http://35.186.221.153/ping", | |
"northamerica-northeast1": "http://35.203.57.164/ping", | |
"southamerica-east1": "http://35.198.10.68/ping", | |
"us-central1": "http://104.197.165.8/ping", | |
"us-east1": "http://104.196.161.21/ping", | |
"us-east4": "http://35.186.168.152/ping", | |
"us-west1": "http://104.199.116.74/ping", | |
"us-west2": "http://35.236.45.25/ping" | |
}; | |
function RUN_LATENCY() { | |
Object | |
.keys(URLS).map(function (key) { | |
var startTime = new Date() | |
UrlFetchApp.fetch(URLS[key]); | |
var endTime = new Date(); | |
var latency = endTime - startTime; | |
return { | |
region: key, | |
latency: latency | |
} | |
}) | |
.sort(function (b,a) { return b.latency - a.latency}) | |
.forEach(function (data) { Logger.log("%s: %s ms", data.region, data.latency)}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment