vmpooler 0.13.3 → 0.14.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/vmpooler +15 -10
- data/lib/vmpooler.rb +4 -16
- data/lib/vmpooler/api.rb +41 -34
- data/lib/vmpooler/api/helpers.rb +1 -1
- data/lib/vmpooler/api/request_logger.rb +20 -0
- data/lib/vmpooler/api/v1.rb +48 -25
- data/lib/vmpooler/generic_connection_pool.rb +7 -5
- data/lib/vmpooler/metrics.rb +24 -0
- data/lib/vmpooler/metrics/dummy_statsd.rb +24 -0
- data/lib/vmpooler/metrics/graphite.rb +47 -0
- data/lib/vmpooler/metrics/promstats.rb +470 -0
- data/lib/vmpooler/metrics/promstats/collector_middleware.rb +124 -0
- data/lib/vmpooler/metrics/statsd.rb +40 -0
- data/lib/vmpooler/pool_manager.rb +29 -34
- data/lib/vmpooler/providers/dummy.rb +2 -1
- data/lib/vmpooler/providers/vsphere.rb +88 -25
- data/lib/vmpooler/version.rb +1 -1
- metadata +23 -5
- data/lib/vmpooler/dummy_statsd.rb +0 -22
- data/lib/vmpooler/graphite.rb +0 -44
- data/lib/vmpooler/statsd.rb +0 -37
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vmpooler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pickup
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '2.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: prometheus-client
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: net-ldap
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,13 +219,18 @@ files:
|
|
205
219
|
- lib/vmpooler/api.rb
|
206
220
|
- lib/vmpooler/api/dashboard.rb
|
207
221
|
- lib/vmpooler/api/helpers.rb
|
222
|
+
- lib/vmpooler/api/request_logger.rb
|
208
223
|
- lib/vmpooler/api/reroute.rb
|
209
224
|
- lib/vmpooler/api/v1.rb
|
210
225
|
- lib/vmpooler/dashboard.rb
|
211
|
-
- lib/vmpooler/dummy_statsd.rb
|
212
226
|
- lib/vmpooler/generic_connection_pool.rb
|
213
|
-
- lib/vmpooler/graphite.rb
|
214
227
|
- lib/vmpooler/logger.rb
|
228
|
+
- lib/vmpooler/metrics.rb
|
229
|
+
- lib/vmpooler/metrics/dummy_statsd.rb
|
230
|
+
- lib/vmpooler/metrics/graphite.rb
|
231
|
+
- lib/vmpooler/metrics/promstats.rb
|
232
|
+
- lib/vmpooler/metrics/promstats/collector_middleware.rb
|
233
|
+
- lib/vmpooler/metrics/statsd.rb
|
215
234
|
- lib/vmpooler/pool_manager.rb
|
216
235
|
- lib/vmpooler/providers.rb
|
217
236
|
- lib/vmpooler/providers/base.rb
|
@@ -228,7 +247,6 @@ files:
|
|
228
247
|
- lib/vmpooler/public/lib/dashboard.js
|
229
248
|
- lib/vmpooler/public/lib/jquery.min.js
|
230
249
|
- lib/vmpooler/public/vmpooler.css
|
231
|
-
- lib/vmpooler/statsd.rb
|
232
250
|
- lib/vmpooler/util/parsing.rb
|
233
251
|
- lib/vmpooler/version.rb
|
234
252
|
- lib/vmpooler/views/dashboard.erb
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Vmpooler
|
4
|
-
class DummyStatsd
|
5
|
-
attr_reader :server, :port, :prefix
|
6
|
-
|
7
|
-
def initialize(*)
|
8
|
-
end
|
9
|
-
|
10
|
-
def increment(*)
|
11
|
-
true
|
12
|
-
end
|
13
|
-
|
14
|
-
def gauge(*)
|
15
|
-
true
|
16
|
-
end
|
17
|
-
|
18
|
-
def timing(*)
|
19
|
-
true
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
data/lib/vmpooler/graphite.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rubygems' unless defined?(Gem)
|
4
|
-
|
5
|
-
module Vmpooler
|
6
|
-
class Graphite
|
7
|
-
attr_reader :server, :port, :prefix
|
8
|
-
|
9
|
-
def initialize(params = {})
|
10
|
-
raise ArgumentError, "Graphite server is required. Config: #{params.inspect}" if params['server'].nil? || params['server'].empty?
|
11
|
-
|
12
|
-
@server = params['server']
|
13
|
-
@port = params['port'] || 2003
|
14
|
-
@prefix = params['prefix'] || 'vmpooler'
|
15
|
-
end
|
16
|
-
|
17
|
-
def increment(label)
|
18
|
-
log label, 1
|
19
|
-
end
|
20
|
-
|
21
|
-
def gauge(label, value)
|
22
|
-
log label, value
|
23
|
-
end
|
24
|
-
|
25
|
-
def timing(label, duration)
|
26
|
-
log label, duration
|
27
|
-
end
|
28
|
-
|
29
|
-
def log(path, value)
|
30
|
-
Thread.new do
|
31
|
-
socket = TCPSocket.new(server, port)
|
32
|
-
begin
|
33
|
-
socket.puts "#{prefix}.#{path} #{value} #{Time.now.to_i}"
|
34
|
-
ensure
|
35
|
-
socket.close
|
36
|
-
end
|
37
|
-
end
|
38
|
-
rescue Errno::EADDRNOTAVAIL => e
|
39
|
-
warn "Could not assign address to graphite server #{server}: #{e}"
|
40
|
-
rescue StandardError => e
|
41
|
-
warn "Failure logging #{path} to graphite server [#{server}:#{port}]: #{e}"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
data/lib/vmpooler/statsd.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rubygems' unless defined?(Gem)
|
4
|
-
require 'statsd'
|
5
|
-
|
6
|
-
module Vmpooler
|
7
|
-
class Statsd
|
8
|
-
attr_reader :server, :port, :prefix
|
9
|
-
|
10
|
-
def initialize(params = {})
|
11
|
-
raise ArgumentError, "Statsd server is required. Config: #{params.inspect}" if params['server'].nil? || params['server'].empty?
|
12
|
-
|
13
|
-
host = params['server']
|
14
|
-
@port = params['port'] || 8125
|
15
|
-
@prefix = params['prefix'] || 'vmpooler'
|
16
|
-
@server = ::Statsd.new(host, @port)
|
17
|
-
end
|
18
|
-
|
19
|
-
def increment(label)
|
20
|
-
server.increment(prefix + '.' + label)
|
21
|
-
rescue StandardError => e
|
22
|
-
warn "Failure incrementing #{prefix}.#{label} on statsd server [#{server}:#{port}]: #{e}"
|
23
|
-
end
|
24
|
-
|
25
|
-
def gauge(label, value)
|
26
|
-
server.gauge(prefix + '.' + label, value)
|
27
|
-
rescue StandardError => e
|
28
|
-
warn "Failure updating gauge #{prefix}.#{label} on statsd server [#{server}:#{port}]: #{e}"
|
29
|
-
end
|
30
|
-
|
31
|
-
def timing(label, duration)
|
32
|
-
server.timing(prefix + '.' + label, duration)
|
33
|
-
rescue StandardError => e
|
34
|
-
warn "Failure updating timing #{prefix}.#{label} on statsd server [#{server}:#{port}]: #{e}"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|