Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QENG-4181] Add per-pool stats to /status API #162

Merged
merged 3 commits into from
Sep 23, 2016

Conversation

rick
Copy link
Contributor

@rick rick commented Sep 9, 2016

Prior to this the only per-pool statistics that could be extracted from the API were a list of empty pools in the "status" section of the returned results of the /status endpoint.

This adds a new "pools" section to the '/status' results which lists, for each
pool, the following results:

  • The number of ready vms in the pool
  • The number of running vms in the pool
  • The number of pending vms in the pool
  • The maximum size of the pool (as specified in the vmpooler configuration)

Example:

{
  "boot": {
  "duration": {
    "average": 163.6,
    "min": 65.49,
    "max": 830.07,
    "total": 247744.71000000002
  },
  "count": {
    "total": 1514
  }
  # ...
  "pools": {
    "pool1": {
      "ready":   5,
      "running": 2,
      "pending": 1,
      "max":     15
    },
    "pool2": {
      "ready":   0,
      "running": 10,
      "pending": 0,
      "max:      10
    }
  }
}

tasks

  • are there more stats we want to include in this?
  • update README.md
  • figure out why jruby won't bundle properly on travis (???)

cc @puppetlabs/vmpooler & @puppetlabs/cinext

Prior to this the only per-pool statistics that could be extracted from the API
were a list of empty pools in the "status" section of the returned results of
the `/status` endpoint.

This adds a new "pools" section to the '/status' results which lists, for each
pool, the following results:

 - The number of ready vms in the pool
 - The number of running vms in the pool
 - The number of pending vms in the pool
 - The maximum size of the pool (as specified in the vmpooler configuration)

Example:

```
{
  "boot": {
  "duration": {
    "average": 163.6,
    "min": 65.49,
    "max": 830.07,
    "total": 247744.71000000002
  },
  "count": {
    "total": 1514
  }
  # ...
  "pools": {
    "pool1": {
      "ready":   5,
      "running": 2,
      "pending": 1,
      "max":     15
    },
    "pool2": {
      "ready":   0,
      "running": 10,
      "pending": 0,
      "max:      10
    }
  }
}
```

This includes spec coverage for this change (we could use more specs on `/status` in general); as well as a couple of general spec improvements.
@rick
Copy link
Contributor Author

rick commented Sep 9, 2016

Jruby tests having bundle install trouble (this PR didn't touch any of this):

https://travis-ci.org/puppetlabs/vmpooler/jobs/158868239

The command "eval bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}" failed 3 times.

@shermdog
Copy link
Contributor

shermdog commented Sep 9, 2016

👍

It's useful to be able to see, in the code, what sort of output we
are generating with endpoints like `/status`.
@stahnma
Copy link

stahnma commented Sep 13, 2016

The jruby issues might be json? Everything lately with bundler has been json.

@rick
Copy link
Contributor Author

rick commented Sep 14, 2016

Digging into this a bit more, the plot thickens. The travis log shows:

�[0K
�[31;1mThe command "bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}" failed and exited with 28 during .�[0m

Which is a bit butchered, but googling around makes me believe that the bundle error statuses are just errno statuses, and errno 28 is "No space left on device" :-/

@rick rick force-pushed the per-pool-stats-in-status branch from 0381a28 to 5a1d547 Compare September 14, 2016 20:28
@rick
Copy link
Contributor Author

rick commented Sep 14, 2016

Put in a shim for travis until a couple of upstream bundler issues get resolved (@9b44c2ffc4a6729f61a27fe25aff5d3ac430267d)

class API
module Helpers
def authenticate(auth, username_str, password_str)
username_str == 'admin' and password_str == 's3cr3t'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YAS HARDCODE

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I know it's a spec test but I love the jankiness of it so much)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only hackers can read leet so that reduces the attack vector to hackers only

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copypasta :-)

@mckern mckern merged commit 8286ec2 into master Sep 23, 2016
@rick
Copy link
Contributor Author

rick commented Sep 23, 2016

I think that the jruby bundler issues may have been resolved, but haven't had time to check yet. We'll want to test and unwind the hack I have here if that's the case.

@rooneyshuman rooneyshuman deleted the per-pool-stats-in-status branch June 5, 2020 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants