Commit graph

380 commits

Author SHA1 Message Date
Scott Schneider
0a9d4e4a3f Don't return 503 for a valid GET /status request 2015-02-26 09:51:14 -08:00
Scott Schneider
a8ecd59014 Merge pull request #58 from colinPL/json_gen_error
(maint) Fix Divide by 0 Bug
2015-02-25 17:47:22 -08:00
Scott Schneider
bfbcde24be set proper HTTP status codes 2015-02-25 17:46:31 -08:00
Scott Schneider
c66315ce26 deprecate 'Hash.new' for '{}' 2015-02-25 17:46:29 -08:00
Scott Schneider
2fa7e1e736 move 'content_type :json' to the beginning of endpoint defs 2015-02-25 17:24:28 -08:00
Colin
67ee061776 (maint) Fix Divide by 0 Bug
When a redis key does not exist for a single-day summary, the
total_clones_per_day array has a length of 1 with a single value of 0.
This gets past an initial check of array length, but is then reduced to
a value of 0, which is then used as the denominator of an average
calculation. The result of this calculation is NaN and later causes
JSON.pretty_generate to raise an exception.

This also includes a check on the min_max_clone_times array, because
[].minmax returns [nil, nil].
2015-02-25 15:52:26 -08:00
Colin
251ae36aa7 Merge pull request #56 from sschneid/summary_default_from
Use today as a default 'from' value
2015-02-25 15:51:21 -08:00
Scott Schneider
e121adb76b Set Sinatra not_found to JSON ok: false 2015-02-25 15:02:29 -08:00
Scott Schneider
7d013a4c2f Use today as a default 'from' value 2015-02-25 14:49:29 -08:00
Scott Schneider
3595453738 Avoid possible divide-by-zero or nil values 2015-02-25 09:12:45 -08:00
Scott Schneider
a4a91a2df9 Predefine capacity:percent and queue:total 2015-02-24 15:51:33 -08:00
Scott Schneider
3d8985fd59 Explicitly set Redis values as integers 2015-02-24 15:36:08 -08:00
Scott Schneider
c29f6e7c66 (Re)structured /status API endpoint 2015-02-24 15:26:29 -08:00
Scott Schneider
d262cb9c95 Merge pull request #53 from colinPL/add_stddev_summary
(QENG-1873) Match status endpoint
2015-02-24 10:00:17 -08:00
Colin
90d6ac2f1b (QENG-1873) Fix Average Duration Calculation
Use the mean helper function to calculate average clone duration.
2015-02-24 09:32:22 -08:00
Colin
85ac329894 (QENG-1873) Fix /0 Error
Calculate total count before trying to use it in average calculation.
2015-02-24 09:26:50 -08:00
Colin
5db5df826f (QENG-1873) Add count Section to summary Result
This adds a :count key to both the overall and daily results. The
payload is now divided in to :duration and :count values for summary
data. The daily results do not include anything under :count except the
total number of VMs cloned for the day. The overall :count includes
total, including minimum, maximum, and average VMs cloned for the date
range requested.
2015-02-24 09:23:58 -08:00
Colin
57520ae995 (QENG-1873) Fix Key Name Issue And minmax
This commit fixes the problem of lingering :timings that were renamed
to :duration. This should resolve a NilClass failure. This also converts
string results from redis to float so that future minmax calls will
treat them as numerics instead of strings.
2015-02-24 08:52:33 -08:00
Colin
ef333ca65f (QENG-1873) Match status endpoint
These changes are to match the status endpoints JSON payload. This also
introduces both clone timings and information on total clones. The field
"day" is renamed to "date" to accomodate when from/to will include
times.
2015-02-23 17:36:50 -08:00
Scott Schneider
97fe235561 Round capacity percentage to 1 decimal place 2015-02-20 14:06:52 -08:00
Scott Schneider
3c22f55793 Predefine entire 'result' hash rather than a-key-at-a-time 2015-02-20 13:23:54 -08:00
Scott Schneider
0253008a3f Extend dashboard stats
This PR includes the following changes:

  - everything at the /dashboard/stats/vmpooler/numbers API endpoint has
  been moved to /status, and stats-vmpooler-numbers.js is now looking to
  /status for it's metrics

  - added '.extra'-classed metrics to stats-vmpooler-numbers.js to pull
  in daily clone totals, average clone time, etc.

  - dashboard.css includes an @media query to display the extra metrics
  if the dashboard's max-width exceeds 1500px
2015-02-20 11:23:48 -08:00
Colin
8a7a327331 Add /summary endpoint
Add an endpoint that returns clone totals and average clone time for
the given time spans. The time spans are determined by the query
parameters "from" and "to", with the resulting range being inclusive of
both. If you want a single day, it should be both the "from" and the
"to" value.
2015-02-20 10:10:18 -08:00
Scott Schneider
525b87d74a Fixing typo in 'percent' 2015-02-17 08:41:19 -08:00
Scott Schneider
13bcc19ff8 Remove subtle dots, fix typo 2015-02-10 16:29:07 -08:00
Scott Schneider
b3a4f9c0a6 Rubocop --auto-correct syntax fixups 2015-02-06 11:08:54 -08:00
Scott Schneider
08ec955098 Ensure 'lifetime' argument provided is an integer 2015-02-04 15:56:32 -08:00
Scott Schneider
49b01a8e00 Display application 'uptime' in API status endpoint 2015-02-04 12:56:59 -08:00
Scott Schneider
e40335a7cf Account for divide-by-zero 2015-02-03 14:38:04 -08:00
Scott Schneider
d6ade5ebef Store and retrieve daily clone statistics from Redis db 2015-02-03 14:14:12 -08:00
Scott Schneider
ecd17606f6 Record clone times in Redis, add a '/status' API endpoint 2015-01-27 12:59:11 -08:00
Scott Schneider
2c0665bb3b Rename 'template'/'count' to 'key'/'value'
This should make the code cleaner; things other than a template name will
be used in the POST interface.
2015-01-09 10:47:24 -08:00
Scott Schneider
b54d42aea4 Allow for a globally-configurable 'pending' timeout 2015-01-08 14:16:13 -08:00
Scott Schneider
489abd713a Wrap hostname-shortening into a [Sinatra helper] method 2014-11-03 13:07:22 -08:00
Scott Schneider
4035114152 Allow VM metadata to be queryable via 'GET' 2014-11-03 09:28:40 -08:00
Scott Schneider
4363d8e067 Store template name in vmpooler__vm__$vm Redis hash 2014-11-03 09:27:28 -08:00
Scott Schneider
8c62e35628 Merge remote-tracking branch 'upstream/master' 2014-10-31 11:53:38 -07:00
Scott Schneider
6d31a63881 Squashed pool squares, stretched running graph 2014-10-31 11:52:36 -07:00
Scott Schneider
b415dc6360 Allow host FQDN in DELETE 2014-10-16 15:14:13 -07:00
Scott Schneider
cb911274dd Ensure hosts aren't in 'maintenance mode' when cloning 2014-09-30 14:25:07 -07:00
Scott Schneider
bb13c8148b (maint) Style fix-ups 2014-09-04 12:09:25 -07:00
Scott Schneider
ba5e713902 Don't deploy VMs to not-good hypervisors
This implements a check to ensure that the VMware host being deployed to
is in a sane ('green') state.
2014-09-04 11:57:01 -07:00
Scott Schneider
5ed2756628 Return a 'domain' JSON key if configured 2014-08-29 11:38:06 -07:00
Scott Schneider
f13bfde893 Textured background, transparent logo 2014-08-27 20:30:43 -07:00
Scott Schneider
8247ea2d30 From http://subtlepatterns.com/cream-pixels/ 2014-08-27 20:30:24 -07:00
Scott Schneider
a353e02b01 Minor CSS tweaks 2014-08-27 18:50:21 -07:00
Scott Schneider
f9f3ae26ba Allow per-pool override for clone_target 2014-08-27 16:45:29 -07:00
Scott Schneider
5078f8f1a0 Increase sleep time = decrease CPU usage 2014-08-26 18:09:55 -07:00
Scott Schneider
c41d8dc3e2 Correctly log a VM's lifetime 2014-08-22 13:35:18 -07:00
Scott Schneider
b836ceea90 Custom-set VM lifetimes override system-wide 2014-08-22 11:04:38 -07:00