mini_statsd 0.2.0 → 0.3.0
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 +4 -4
- data/lib/mini_statsd.rb +1 -1
- data/lib/port_sanitizer.rb +2 -2
- data/lib/statsd_listener.rb +6 -5
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd61e0e40ee77ffbbf4a20fe2b104189b393dbc7
|
4
|
+
data.tar.gz: 932f6d4ae4adc56175f6c1bf8f84746af48767b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c985c698740b77932666dea4bb065fb602c56863643c86ce0cb00de9a2ff000a0b80ac4acbd5f4784b4c64039bc1bb28fce604ad47773ec29c0d42d7de400091
|
7
|
+
data.tar.gz: cff342601ffcbbb20032480bf5a02956f68c39a4d0d98d78e89a0179699abf430dff59c06fc5903cf9bb862d2d9a5f5e7a5d7605813c3e618ec9b83902040983
|
data/lib/mini_statsd.rb
CHANGED
data/lib/port_sanitizer.rb
CHANGED
@@ -8,8 +8,8 @@ class PortSanitizer
|
|
8
8
|
|
9
9
|
port = port.to_i
|
10
10
|
|
11
|
-
|
12
|
-
puts "#{color.yellow(
|
11
|
+
unless port.between?(1024, 49151)
|
12
|
+
puts "#{color.yellow("Invalid or no port informed. Assigning default port (#{DEFAULT_PORT})")}.\n\n"
|
13
13
|
|
14
14
|
return DEFAULT_PORT
|
15
15
|
end
|
data/lib/statsd_listener.rb
CHANGED
@@ -5,23 +5,24 @@ require_relative 'port_sanitizer'
|
|
5
5
|
class StatsdListener
|
6
6
|
include Term::ANSIColor
|
7
7
|
|
8
|
-
def self.run(port)
|
8
|
+
def self.run(port: nil, host: nil)
|
9
9
|
puts "Starting MiniStatsd...\n\n"
|
10
10
|
|
11
|
-
new(port).run
|
11
|
+
new(host: host, port: port).run
|
12
12
|
end
|
13
13
|
|
14
|
-
def initialize(port:)
|
14
|
+
def initialize(host: nil, port: nil)
|
15
15
|
$stdout.sync = true
|
16
16
|
|
17
17
|
@socket = UDPSocket.new
|
18
18
|
@port = PortSanitizer.sanitize(port)
|
19
|
+
@host = host.nil? ? '127.0.0.1' : host
|
19
20
|
|
20
|
-
@socket.bind(
|
21
|
+
@socket.bind(@host, @port)
|
21
22
|
end
|
22
23
|
|
23
24
|
def run
|
24
|
-
puts "Listening on
|
25
|
+
puts "Listening on #{@host}:#{@port}"
|
25
26
|
|
26
27
|
while @message = @socket.recvfrom(@port)
|
27
28
|
extract_metric
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_statsd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Marques
|
@@ -55,9 +55,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
57
|
rubyforge_project:
|
58
|
-
rubygems_version: 2.
|
58
|
+
rubygems_version: 2.5.1
|
59
59
|
signing_key:
|
60
60
|
specification_version: 4
|
61
61
|
summary: Mini StatsD
|
62
62
|
test_files: []
|
63
|
-
has_rdoc:
|