echo_cli 0.6.32 → 0.6.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/echo_cli.gemspec +1 -1
- data/lib/echo_cli/cli.rb +24 -12
- data/lib/echo_cli/version.rb +1 -1
- data/vendor/cache/colorize-0.8.1.gem +0 -0
- data/vendor/cache/highline-1.7.8.gem +0 -0
- data/vendor/cache/minitest-5.10.1.gem +0 -0
- data/vendor/cache/rake-10.1.0.gem +0 -0
- data/vendor/cache/thor-0.19.4.gem +0 -0
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f538e55c167475588bcdddfe4ffb4d6808b869c
|
4
|
+
data.tar.gz: e377c43cd10c5a199cc7e7693888c5b02db225db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf1b9790803ef37b1be2a370c5bfb3010454fb12a152e42f0a6755b5f42ee99ab01c6d0ef43e528b5ef3a10ce4d09920363f1eb7f4efd065d2258a529ee8671b
|
7
|
+
data.tar.gz: 3e1530c96aafb0cab03f65c6d6f504a50b8fd2222a6f5dc699b33a2f6518093c650343e7e4ac2f49ae0c6171006799c48623061b7c4d425894eedabaeb267cc4
|
data/.gitignore
CHANGED
data/echo_cli.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "echo_cli"
|
8
8
|
spec.version = Echo_cli::VERSION
|
9
9
|
spec.authors = ["Brandon Raphael"]
|
10
|
-
spec.email = ["
|
10
|
+
spec.email = ["braphael@email.arizona.edu"]
|
11
11
|
|
12
12
|
spec.summary = "A gem to interact directly with Echo's stack. Post metrics to Echo's StatsD server."
|
13
13
|
spec.homepage = "https://www.github.allstate.com"
|
data/lib/echo_cli/cli.rb
CHANGED
@@ -46,12 +46,12 @@ module Echo_cli
|
|
46
46
|
time_start = Time.new.to_i.to_s
|
47
47
|
|
48
48
|
# sort of a mini-smoketest to ensure the posts will work before creating a background process
|
49
|
-
helper.
|
49
|
+
helper.do_post_udp(ENV["ECHO_CLI_HOST"], "8125", metric)
|
50
50
|
|
51
51
|
pid = Process.fork do
|
52
52
|
prng = Random.new
|
53
53
|
while true do
|
54
|
-
helper.
|
54
|
+
helper.do_post_udp(ENV["ECHO_CLI_HOST"], "8125", metric)
|
55
55
|
sleep prng.rand(0.1...1.0)
|
56
56
|
end
|
57
57
|
end
|
@@ -65,7 +65,7 @@ module Echo_cli
|
|
65
65
|
end
|
66
66
|
|
67
67
|
while num > 0
|
68
|
-
helper.
|
68
|
+
helper.do_post_udp(ENV["ECHO_CLI_HOST"], "8125", metric)
|
69
69
|
puts "\nPosted ".green + metric.yellow + " to ".green + "http://".yellow + ENV["ECHO_CLI_HOST"].yellow + ":".yellow + "8125".yellow + " at ".green + Time.new.to_i.to_s.yellow
|
70
70
|
num -= 1
|
71
71
|
end
|
@@ -145,7 +145,7 @@ module Echo_cli
|
|
145
145
|
> $ echo_cli populate 'example.back.populate:1|c' {600} {100}
|
146
146
|
LONGDESC
|
147
147
|
|
148
|
-
def populate(metric, timespan =
|
148
|
+
def populate(metric, timespan = 1209600, frequency = 600)
|
149
149
|
helper = Helper.new
|
150
150
|
helper.set_envs
|
151
151
|
metric = metric.gsub(/'/,"").gsub(/"/,"")
|
@@ -159,6 +159,8 @@ module Echo_cli
|
|
159
159
|
|
160
160
|
if input == "y"
|
161
161
|
puts "\nPopulating..."
|
162
|
+
timespan = timespan.to_i
|
163
|
+
frequency = frequency.to_i
|
162
164
|
while timespan >= 0
|
163
165
|
to_post = helper.get_metric_string_populate(metric) + " " + prng.rand(0...100).to_s + " " + (now - timespan).to_s
|
164
166
|
helper.do_post_tcp(ENV["ECHO_CLI_HOST"], "2003", to_post)
|
@@ -257,13 +259,13 @@ module Echo_cli
|
|
257
259
|
type = metric[metric.index('|') + 1 .. metric.length]
|
258
260
|
case type
|
259
261
|
when 'c'
|
260
|
-
return
|
262
|
+
return metric[0..metric.index(':')-1] + ".*"
|
261
263
|
when 'ms'
|
262
|
-
return
|
264
|
+
return metric[0..metric.index(':')-1] + ".*"
|
263
265
|
when 's'
|
264
|
-
return
|
266
|
+
return metric[0..metric.index(':')-1] + ".*"
|
265
267
|
when 'g'
|
266
|
-
return
|
268
|
+
return metric[0..metric.index(':')-1]
|
267
269
|
end
|
268
270
|
end
|
269
271
|
|
@@ -271,13 +273,13 @@ module Echo_cli
|
|
271
273
|
type = metric[metric.index('|') + 1 .. metric.length]
|
272
274
|
case type
|
273
275
|
when 'c'
|
274
|
-
return
|
276
|
+
return metric[0..metric.index(':')-1] + ".count"
|
275
277
|
when 'ms'
|
276
|
-
return
|
278
|
+
return metric[0..metric.index(':')-1] + ".count"
|
277
279
|
when 's'
|
278
|
-
return
|
280
|
+
return metric[0..metric.index(':')-1] + ".count"
|
279
281
|
when 'g'
|
280
|
-
return
|
282
|
+
return metric[0..metric.index(':')-1]
|
281
283
|
end
|
282
284
|
end
|
283
285
|
|
@@ -290,6 +292,16 @@ module Echo_cli
|
|
290
292
|
return true
|
291
293
|
end
|
292
294
|
|
295
|
+
def do_post_udp(statsd_uri, port, request_body)
|
296
|
+
begin
|
297
|
+
udpsocket = UDPSocket.new
|
298
|
+
udpsocket.connect(statsd_uri, port)
|
299
|
+
udpsocket.write(request_body)
|
300
|
+
udpsocket.close
|
301
|
+
rescue Errno::ECONNREFUSED
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
293
305
|
def do_post_tcp(statsd_uri, port, request_body)
|
294
306
|
begin
|
295
307
|
timeout(10) do
|
data/lib/echo_cli/version.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: echo_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.33
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Raphael
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -96,7 +96,7 @@ dependencies:
|
|
96
96
|
version: '5.0'
|
97
97
|
description:
|
98
98
|
email:
|
99
|
-
-
|
99
|
+
- braphael@email.arizona.edu
|
100
100
|
executables:
|
101
101
|
- console
|
102
102
|
- echo_cli
|
@@ -121,6 +121,11 @@ files:
|
|
121
121
|
- lib/echo_cli.rb
|
122
122
|
- lib/echo_cli/cli.rb
|
123
123
|
- lib/echo_cli/version.rb
|
124
|
+
- vendor/cache/colorize-0.8.1.gem
|
125
|
+
- vendor/cache/highline-1.7.8.gem
|
126
|
+
- vendor/cache/minitest-5.10.1.gem
|
127
|
+
- vendor/cache/rake-10.1.0.gem
|
128
|
+
- vendor/cache/thor-0.19.4.gem
|
124
129
|
homepage: https://www.github.allstate.com
|
125
130
|
licenses:
|
126
131
|
- MIT
|