Commit graph

509 commits

Author SHA1 Message Date
kirby@puppetlabs.com
21bf9dbc1c Fix syntax of validate_token in helpers
This change fixes an error in validate_token where hset does not have the correct number of parameters. Without this change validate_token causes a error.
2020-11-09 11:05:58 -08:00
kirby@puppetlabs.com
cfd6a5f991 (POOLER-193) Mark checked out VM as active
This change sets a VM as running in redis as soon as it is checked out. Without this change when allocated several instances it is possible for a machine that has been allocated for a checkout, but not yet marked as active, to be identified as running when it should not be, which was added in POOLER-191. Without this change a machine may be destroyed during checkout by pool_manager if there are several instances being allocated.

Additionally, redis multi is added for vm checkout operations to minimize the round trips to redis during a checkout operation. Without this addition each VM checkout causes several redis interactions.
2020-11-09 11:05:56 -08:00
John O'Connor
11bda0f31a (MAINT) Fix checkout counter allocation
Checkout metric counters were against the template name and not the
actual pool used which prevents us from counting the checkouts in the
pixa4 pools for example.
2020-11-06 20:46:11 +00:00
Belén
7f3d867b5c
Merge branch 'master' into pooler-192 2020-10-26 11:34:13 -07:00
Belen Bustamante
474aba379c Rubocop fix 2020-10-26 10:25:54 -07:00
Jenkins
32e9b6c330 (GEM) update vmpooler version to 0.18.0 2020-10-26 16:26:29 +00:00
Belen Bustamante
2a6d610b7a Rubocop fix 2020-10-23 17:41:02 -07:00
Samuel
0a323f6052
(maint) Speedup the tagging method (#422)
* (maint) Speedup the tagging method
While looking at the instrumentation data for the ABS queue processor,
I noticed a lot of time spent in the HTTP PUT method, which in the code
was easy to isolate, as it is only used via the vmpooler tagging functions
ie the API /vm/foobar/ with 'tag' key-value pairs.
While I'm not sure the original hset() make sense to me, there was an easy
way to speed them up by using pipelined. I would expect a very good speed
increase with this turned on.

* tag rubocop to <1.0 because the 1.0 version returns 130 new offenses
2020-10-23 09:40:11 -07:00
Jenkins
981d110bbf (GEM) update vmpooler version to 0.17.0 2020-10-20 15:27:00 +00:00
suckatrash
b2ac53fa76
(DIO-1059) Optionally add snapshot tuning params at clone time 2020-10-16 16:29:29 -07:00
Jenkins
a42ed6cb5d (GEM) update vmpooler version to 0.16.3 2020-10-14 19:26:09 +00:00
kirby@puppetlabs.com
0ad069b958 (POOLER-191) Add checking for running instances that are not in active
This change adds detection of running instances that are in a running
queue, but have no data in a active queue for the same pool. When this
happens a machine will live forever, impacting the running count, and
preventing the machine from being killed. Without this change running
instances that are not marked as active will live forever.
2020-10-13 14:17:51 -07:00
Jenkins
35104a75bb (GEM) update vmpooler version to 0.16.2 2020-10-08 22:44:29 +00:00
Jenkins
a8bdfc1647 (GEM) update vmpooler version to 0.16.1 2020-10-08 19:06:50 +00:00
Jenkins
ccdf8a4ccb (GEM) update vmpooler version to 0.16.0 2020-10-08 19:02:28 +00:00
f5698d49fc
Update to OTel 0.7.0
This update includes two key benefits:

1. Spans will be named based on their route instead of the full path
   info thanks to https://github.com/open-telemetry/opentelemetry-ruby/pull/415
2. Helper methods were added to the configurator to simplify setting
   service.name and service.version
2020-10-08 09:49:45 -04:00
Jenkins
4e7e16e001 (GEM) update vmpooler version to 0.15.0 2020-09-30 20:12:39 +00:00
Belen Bustamante
08132f75bd
Add healthcheck endpoint, spec testing 2020-09-22 12:25:26 -07:00
Jenkins
4d06c01d21 (GEM) update vmpooler version to 0.14.9 2020-09-21 17:45:43 +00:00
Jenkins
b484cc5992 (GEM) update vmpooler version to 0.14.8 2020-09-18 19:05:23 +00:00
Jenkins
c49a94a819 (GEM) update vmpooler version to 0.14.7 2020-09-18 16:07:03 +00:00
214f01c501
Add OTel resource detecors
Adding this should allow OpenTelemetry to detect information about our
Kubernetes environment.
2020-09-17 21:11:07 -04:00
8f3039e321
Add distributed tracing (#399)
This change utilizes OpenTelemetry's automatic instrumentation to add
distributed tracing capabilities to VMPooler. This is a non-breaking
change as traces are processed in noop mode by default.
2020-09-17 15:35:21 -04:00
Jenkins
8dda72ebb3 (GEM) update vmpooler version to 0.14.6 2020-09-17 15:14:18 +00:00
Samuel Beaulieu
1c53625fd8 add the default in the standard location, also adding
support for an ENV var. Update the example yaml file with the new config
2020-09-03 08:49:45 -05:00
Samuel Beaulieu
a35d66c606 (POOLER-184) Pool manager retry and exit on failure
Adding a reconnect retry for redis, which by default would retry 10 times,
for a total wait time of ~80 seconds
2020-09-02 11:38:40 -05:00
Belen Bustamante
07d1ca2b2c Add promstats component check 2020-08-29 09:40:29 -07:00
Jenkins
d47df61c19 (GEM) update vmpooler version to 0.14.5 2020-08-21 18:15:48 +00:00
f8c64b4006
Merge pull request #396 from jcoconnor/MAINT-Fix-Staledns-count
(MAINT) Fix Staledns error counter
2020-08-21 14:13:24 -04:00
John O'Connor
18988ddc3c (MAINT) Fix Staledns error counter
This was logging the hostname instead of the poolname.
2020-08-21 19:03:19 +01:00
Jenkins
90e91f858a (GEM) update vmpooler version to 0.14.4 2020-08-21 17:30:39 +00:00
John O'Connor
3050e99fd6 (MAINT) Normalise all tokens for stats
/api/v1/token, /token, /img and /lib endpoints need to be normalised the
same way that /vm and /ondemandvm endpoints are handled.
2020-08-21 17:24:56 +01:00
Jenkins
f4f0904168 (GEM) update vmpooler version to 0.14.3 2020-08-06 00:11:19 +00:00
kirby@puppetlabs.com
c6fdc8d6fd (POOLER-186) Fix template alias evaluation with backend weight of 0
This change fixes template alias evaluation to ensure that the correct
data is set when generating on demand requests for pools that have a
backend weight configured for a value of 0. Without this change vmpooler
will return an empty selection in api for template alias evaluation.

To support this change tests are added that first reproduced the
failure, and then verified that it is resolved with the addition of the
patch. Additionally, test coverage is added to ensure that code paths
that include pickup gem usage are covered.
2020-08-05 16:33:10 -07:00
John O'Connor
0a6ad896f5 (MAINT) Clarity refactor of Prom Stats code
Introducing the Prometheus Stats code into ABS showed that the Clarity
could be improved a bit with better variable naming, some refactoring
to reduce repitition and documenting the Metrics table itself.

Filtering these changes back to the vmpooler code base.
2020-08-05 14:57:48 +01:00
Jenkins
2556ed6105 (GEM) update vmpooler version to 0.14.2 2020-08-03 22:24:28 +00:00
kirby@puppetlabs.com
ef4ca261d0 Fix vmpooler folder purging
This commit updates folder purging references to ensure that provider
name references are referring to the named provider, rather than the
provider type. Without this change folder purging fails because it
cannot identify target folders.
2020-08-03 15:08:03 -07:00
kirby@puppetlabs.com
ef7e54e288 Ensure lifetime is set when creating ondemand instances 2020-08-03 14:22:51 -07:00
Jenkins
733506fdd9 (GEM) update vmpooler version to 0.14.1 2020-07-08 20:11:28 +00:00
kirby@puppetlabs.com
88899d4513 Correctly handle multiple pools of same alias in ondemand checkout
This commit updates the method used for chceking the status of an
ondemand request to ensure that if multiple aliases are used to fulfill
a request that they are correctly presented as a single pool again when
everything is ready. Without this change it is possible for only one
group of an aliased pool to show up in pending or completed requests.
2020-07-08 09:15:47 -07:00
Jenkins
6d01079f4a (GEM) update vmpooler version to 0.14.0 2020-07-01 18:19:27 +00:00
John O'Connor
416f1f6e7b (POOLER-160) Revise Redis buckets
Output from our discussion on histogram buckets for the Clone, Time to
ready and Redis connection buckets.
2020-06-30 21:56:37 +01:00
John O'Connor
85ff3f7022 (MAINT) Add optional API Request Logging
This was partially an exercise to use middleware, but also to enable
basic logging for the API by logging all the API calls to the logger.
2020-06-29 19:56:29 +01:00
John O'Connor
a21d8c5642 (POOLER-178) Target Stats for api & manager
Ensure that the correct stats are registered for the Manager and the api
respectively. E.g. all checkout counters are for the api only, whereas
clone times belong to the manager.

Also new ondemand functionality stats weren't registered, so add these
along with missing delete stats.
2020-06-29 19:54:28 +01:00
John O'Connor
8ed8c43970 (POOLER-160) Revise Metrics Classwork
Review changes suggested to revise the Metrics related files into a more
logical class structure.

Also fixup grammar typos in docs strings and any trailing metrics that
have been recently added to vmpooler.
2020-06-29 19:54:28 +01:00
John O'Connor
cb955a1bed (POOLER-177) Filter hostname from API Paths
Use the example provided in the Ruby Client to provide a customised
collector appropriate to log all calls to the API. The customised
filtering is used to replace individual node names and templates
for the /vm and request ID's for the /ondemand endpoints.

This module was failing our rubocop checks so have updated it since
it now forms part of vmpooler.

Separate trapping for litmus jobs is also included so that they don't
interfere with stats from the jenkins pipelines.
2020-06-29 19:53:59 +01:00
John O'Connor
b6dcd77228 (POOLER-170) Revise vmpooler usage stats
Break down the usage stats into smaller groups so as to manage the
number of stat lines collected for Prometheus.

This may need some further revision to filter out Litmus stats, or
otherwise collect litmus usage information.
2020-06-29 19:52:15 +01:00
John O'Connor
72564de4b4 (POOLER-160) Revise connection metrics
The redis pooler connection metric used "metric_prefix" which is
misleading, so split this into connpool_type and connpool_provider.
Also remove some earlier jruby compatibility code to reduce
rebase conflicts when this is rebased on top of Matt's changes.
2020-06-29 19:52:14 +01:00
John O'Connor
5c38ba240a (POOLER-160) Revise some smelly logger code
Need the logger code in promstats.rb so move logger initialisation to
the top of the vmpooler script, remove the class method from vmpooler.rb
and make appropriate downstream changes to metrics and pooler manger
handling.

This also means we can start decent logging in the API if we wish do.

Fixed up to rebase on top of Matts POOLER-158 changes
2020-06-29 19:52:14 +01:00
John O'Connor
bbd76bde4c (POOLER-160) Add Prometheus to pooler startup
This is a re-architect of the vmpooler initialisation code to:
1. Allow an API service for both manager and the api
2. Add the Prometheus endpoints to the web service.
   Needed to change the way the Rack Service is started as instantiating
   using ".New" leads to a failure to initialise the http Stats
   collection.
3. Selectively load the pooler api and/or Prometheus endpoints.
4. Rework API Spec tests for revised API loading. Needed to tidy up the
   initialisation and perform a reset! after each test to avoid "leaks"
   and dependencies between the tests.
2020-06-29 19:52:14 +01:00