lumbersexual 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/exe/lumbersexual +2 -1
- data/lib/lumbersexual/plugin/latency.rb +10 -2
- data/lib/lumbersexual/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmM3ZGZiOTJlNGQ0MjQxZjkzNzVjOTZjODI1MGI3MTc3YTYyNGQ1NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2Q5NmRiOTQxYzc5MzkxODhhYzAzMmQ0OWNhMjllNDFmZGMxNzU3Yw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZGIzYmQzNzg5ZGRmMTg5MzgwOGY2ZGM4NjU2YzA1NzNkMTRmNWEwMDRjNTZl
|
10
|
+
M2EwZDYyODZlNWJjMzgzYTI3ZDNiODg1NWM5ODkxNmEwZDFkNWFhNjBmZDlk
|
11
|
+
N2RkZWEwNWMzOTNjZjQwOWUxYzQ2ODAwZDdlMGM2YWNjMDJlZDc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjJlYWIzZjkyN2M3MTBiZDU2Zjg4MDJiMjM4ODBiYjc5MTkzMWM0YmU1ZTg0
|
14
|
+
YTAxZTlhMjFhNDBmM2QyNzM2YzY4ZjkwNjIwOGVhZWNiNTczZTAzYjFmMWJi
|
15
|
+
ZWI4Y2JiYzY3ZDdkNDQxNDI4NjIzMTAwN2JiMjcxNDE1OTc1ZWQ=
|
data/exe/lumbersexual
CHANGED
@@ -10,11 +10,12 @@ options = Slop.parse do |o|
|
|
10
10
|
o.string '-D', '--dictionaryfile', 'path to dictionary file (default: /etc/dictionaries-common/words)', default: '/etc/dictionaries-common/words'
|
11
11
|
o.array '-f', '--facilities', 'additional comma-seperated facilities', default: []
|
12
12
|
o.bool '-h', '--help', 'print this message'
|
13
|
+
o.integer '-i', '--interval', 'in latency mode, the interval in seconds to sleep between index queries (default 0.1)', default: 0.1
|
13
14
|
o.bool '-l', '--latency', 'run in latency rather than generation mode (default: no)', default: nil
|
14
15
|
o.integer '-M', '--maxwords', 'maximum number of words per message (default: 20)', default: 20
|
15
16
|
o.integer '-m', '--minwords', 'minimum number of words per message (default: 3)', default: 3
|
16
17
|
o.array '-p', '--priorities', 'additional comma-seperated priorities', default: []
|
17
|
-
o.integer '-r', '--rate', 'messages per second per thread (default:
|
18
|
+
o.integer '-r', '--rate', 'messages per second per thread (default: 50, 0 for unlimited)', default: 50
|
18
19
|
o.string '-s', '--statsdhost', 'send statsd telemetry to the named host (default: off)', default: nil
|
19
20
|
o.integer '-T', '--threads', 'number of threads (defaults to number of cores * 2)', default: Etc.nprocessors * 2
|
20
21
|
o.integer '-t', '--timeout', 'length of execution. 0 for forever (default: 0)', default: 0
|
@@ -10,6 +10,7 @@ require "elasticsearch"
|
|
10
10
|
module Lumbersexual
|
11
11
|
module Plugin
|
12
12
|
class Latency
|
13
|
+
|
13
14
|
def initialize(options, *args)
|
14
15
|
@options = options
|
15
16
|
@found = false
|
@@ -25,6 +26,7 @@ module Lumbersexual
|
|
25
26
|
end
|
26
27
|
|
27
28
|
uuid = SecureRandom.uuid
|
29
|
+
@sleep_count = 0
|
28
30
|
@start_time = Time.now
|
29
31
|
Timeout::timeout(@options[:timeout]) {
|
30
32
|
syslog = Syslog.open('lumbersexual-ping', Syslog::LOG_CONS | Syslog::LOG_NDELAY | Syslog::LOG_PID, Syslog::LOG_INFO)
|
@@ -34,6 +36,8 @@ module Lumbersexual
|
|
34
36
|
until @found do
|
35
37
|
result = elastic.search index: index_name, q: uuid
|
36
38
|
@found = true if result['hits']['total'] == 1
|
39
|
+
@sleep_count += 1
|
40
|
+
sleep @options[:interval]
|
37
41
|
end
|
38
42
|
}
|
39
43
|
|
@@ -45,9 +49,13 @@ module Lumbersexual
|
|
45
49
|
statsd = Statsd.new(@options[:statsdhost]).tap { |s| s.namespace = "lumbersexual.latency" } if @options[:statsdhost]
|
46
50
|
|
47
51
|
if @found
|
48
|
-
|
52
|
+
latency = @end_time - @start_time
|
53
|
+
adjusted_latency = latency - (@options[:interval] @sleep_count)
|
54
|
+
puts "Measured Latency: #{latency}"
|
55
|
+
puts "Interval Adjusted Latency: #{adjusted_latency}"
|
49
56
|
statsd.gauge 'runs.successful', 1 if @options[:statsdhost]
|
50
|
-
statsd.gauge 'rtt',
|
57
|
+
statsd.gauge 'rtt.measured', latency if @options[:statsdhost] if @options[:statsdhost]
|
58
|
+
statsd.gauge 'rtt.adjusted', adjusted_latency if @options[:statsdhost] if @options[:statsdhost]
|
51
59
|
else
|
52
60
|
statsd.gauge 'runs.failed', 1 if @options[:statsdhost]
|
53
61
|
puts "Latency: unknown, message not found"
|
data/lib/lumbersexual/version.rb
CHANGED