Created
October 3, 2013 23:19
-
-
Save dound/6818604 to your computer and use it in GitHub Desktop.
Augments the Google App Engine (GAE) instances overview page with the (instantaneous) average instance lifespan. Longer is better!
This file contains 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
// ==UserScript== | |
// @name Augment GAE Instance List | |
// @version 0.1 | |
// @namespace http://www.dound.com/ | |
// @description augments instance page with average lifetime | |
// @match https://appengine.google.com/instances* | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js | |
// ==/UserScript== | |
window.setTimeout(function () { | |
"use strict"; | |
var n = 0, | |
sum = 0; | |
$('#ae-instances-details-table tbody tr').each(function (i, e) { | |
var agePieces = $(e).find('td')[4].innerHTML.trim().split(":"); | |
n += 1; | |
sum += parseInt(agePieces[0], 10) * 3600 + parseInt(agePieces[1], 10) * 60 + parseInt(agePieces[2], 10); | |
}); | |
$('#ae-instances-details-table caption').append("<span>Average Lifespan: " + (sum / n).toFixed(0) + " seconds</span>"); | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment