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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzBhYmRiMWRmOWM1NjUyM2M5ZGRjMzI1YTVkOWZlMmQ2MTIwOTI4NA==
4
+ MmM3ZGZiOTJlNGQ0MjQxZjkzNzVjOTZjODI1MGI3MTc3YTYyNGQ1NQ==
5
5
  data.tar.gz: !binary |-
6
- YmE3ODkyOGRkYzVmMGY5YTBkZTRkMWM2Mjc2NDA0NmE4ZTFjMWU0Yw==
6
+ M2Q5NmRiOTQxYzc5MzkxODhhYzAzMmQ0OWNhMjllNDFmZGMxNzU3Yw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Y2E5NTNmNDJjMDM4ZjEwZDNlYzViZjUwZGRkYjA1MTlkYjkwNWQ3ZmQxMTVm
10
- ZWY4MmZjYzFmYmIxZTRmZjhkOGVkZmFiYjY0MGZlMGJjMmY4NDM1ZTA5ODMw
11
- OTlkNzlkYTllNWJjM2E1ODJlNTVmZDU0NjdhNmNmMGZkMTc4N2M=
9
+ ZGIzYmQzNzg5ZGRmMTg5MzgwOGY2ZGM4NjU2YzA1NzNkMTRmNWEwMDRjNTZl
10
+ M2EwZDYyODZlNWJjMzgzYTI3ZDNiODg1NWM5ODkxNmEwZDFkNWFhNjBmZDlk
11
+ N2RkZWEwNWMzOTNjZjQwOWUxYzQ2ODAwZDdlMGM2YWNjMDJlZDc=
12
12
  data.tar.gz: !binary |-
13
- ODYxYzVhMGI2ODcyZWJmYmFhYmY3MzJjNDBhY2Y3ZjU3MTc4MmFjMjdlN2Yz
14
- MDRlYjYwYThiYTEzNThjMmYwYzQ4NDUzNzExNmMzZDA2M2ViZGJkYmYyZWFj
15
- YzBjZjZkYmRiNzMxNjhiZDYzYjRkM2UyMGJmNmM4ZmEyZTg2NTc=
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: 0, unlimited)', default: 0
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
- puts "Latency: #{@end_time - @start_time}"
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', @end_time - @start_time if @options[:statsdhost] if @options[:statsdhost]
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"
@@ -1,3 +1,3 @@
1
1
  module Lumbersexual
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lumbersexual
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Pointer