echo_cli 0.6.18 → 0.6.19

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a234d650ed7a98258fa860242a76555009e6b312
4
- data.tar.gz: 9beedfea04e7babafeaea17ad701674a5f16f6eb
3
+ metadata.gz: 061f3487e6d0be96c2a48f11c114c4dd2128e887
4
+ data.tar.gz: 0d3a15469d351b5c10371e1f4b04fa8409443915
5
5
  SHA512:
6
- metadata.gz: d1826547e8cf2f294a893b56f34b85253ddad6d844e7cf42a4456e5f5050580f7d8a509adf94a1ed5426953ae29422bb19d1041b55cfbd4b3b8a37c058105633
7
- data.tar.gz: dc98048eb583be0ed12367123bf9bd2cb0545416afcbe75f3c5e50ed6b738570281a1308367092d53ba66aa55025288813885e3792d58d1a623e16a7463632d7
6
+ metadata.gz: 26483bcb7d0eeb6e7444017201afe0e22fc19b2226e3ae50a325a4b236946426187972239abd4de52c973d5abe09ac40826528916774f8317c24f6b648868f65
7
+ data.tar.gz: 8691197e9f88518fa22ab15da0fcc97a72f68270656b87beeb62f47762f9d3af5e332bfbd1728c0895d10bdc80ad99c37cea45aaa73376831e817beeb4f289a6
data/README.md CHANGED
@@ -42,6 +42,40 @@ $ echo_cli help [COMMAND]
42
42
 
43
43
  ### Commands
44
44
 
45
+ #### convert
46
+ ```bash
47
+ $ echo_cli convert <timestamp>
48
+ ```
49
+ Parameters:
50
+
51
+ `<timestamp>`: (required) the timestamp you wish to convert, it can be given in either epoch time or a human-readable format. Ensure that the epoch timestamp is in seconds, and does not have any punctuation. Ensure that the human-readable timestamp is of the form: YYYY-MM-DDTHH:MM:SS-Z (decimals may follow the SS value).
52
+
53
+ Example:
54
+ ```bash
55
+ $ echo_cli convert 1492186214
56
+ ```
57
+ The previous example will convert the provided epoch timestamp into a human-readable format.
58
+
59
+ #### cpost
60
+ ```bash
61
+ $ echo_cli cpost <URL> '<metric>' {frequency} {-z}
62
+ ```
63
+ Parameters:
64
+
65
+ `<URL>`: (required) specifies the StatsD endpoint you are attempting to post a metric to
66
+
67
+ `'<metric>'`: (required) the metric name, as well as any tags, and data value and data type to be posted to StatsD
68
+
69
+ `{frequency}`: (optional) the rate at which the metric will be continuously posted to Echo's server. If left unspecified, this value will default to 10 seconds.
70
+
71
+ `{-z}`: (optional) spawn the continuous post process in the background. Additionally, this option will return a PID (Process ID) that can be used in the future to kill the command. Use `kill -9 <PID>` to kill the process.
72
+
73
+ Example:
74
+ ```bash
75
+ $ echo_cli cpost https://localhost:8125/metrix 'example.post:1|c' 5 -z
76
+ ```
77
+ The previous example will post the metric 'example' with tag 'post' to Echo's StatsD server instance at 'https://localhost:8125/metrix' once every 5 seconds. The specified '-z' option will spawn the process in the background, and return the newly spawned process ID in the command line.
78
+
45
79
  #### help
46
80
  ```bash
47
81
  $ echo_cli help [COMMAND]
@@ -63,7 +97,6 @@ Parameters:
63
97
 
64
98
  `'<metric>'`: (required) the metric name, as well as any tags, and data value and data type to be posted to StatsD
65
99
 
66
-
67
100
  `{number}`: (optional) the number of posts to occur, e.g. a number value of '10' would post the metric 10 times to the StatsD server
68
101
 
69
102
 
@@ -107,7 +140,7 @@ Parameters:
107
140
 
108
141
  `'<metric>'`: (required) the metric name, including any tags, with which the query for OpenTSDB will be constructed
109
142
 
110
- `<range>`: (required) the time, in seconds from the current time (epoch time) that you would like to query, e.g. a 'range' value of 300 would query OpenTSDB for the specified metric in the last 5 minutes of time-series data
143
+ `<range>`: (required) the time, in seconds, from the current time (epoch time) that you would like to query, e.g. a 'range' value of 300 would query OpenTSDB for the specified metric in the last 5 minutes of time-series data
111
144
 
112
145
  `{-e}`: (optional) formats the response datapoints such that their timestamps are in the epoch format
113
146
 
@@ -117,20 +150,6 @@ $ echo_cli https://localhost:4242/api/query 'sample.query.here' 300
117
150
  ```
118
151
  The previous example will query OpenTSDB located on 'https://localhost:4242/api/query' with the metric name 'sample' and tags 'query' and 'here', within the time range spanning from the current time to '300' seconds before the current time.
119
152
 
120
- #### convert
121
- ```bash
122
- $ echo_cli convert <timestamp>
123
- ```
124
- Parameters:
125
-
126
- `<timestamp>`: (required) the timestamp you wish to convert, it can be given in either epoch time or a human-readable format. Ensure that the epoch timestamp is in seconds, and does not have any punctuation. Ensure that the human-readable timestamp is of the form: YYYY-MM-DDTHH:MM:SS-Z (decimals may follow the SS value).
127
-
128
- Example:
129
- ```bash
130
- $ echo_cli convert 1492186214
131
- ```
132
- The previous example will convert the provided epoch timestamp into a human-readable format.
133
-
134
153
  ## Development
135
154
 
136
155
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
data/lib/echo_cli/cli.rb CHANGED
@@ -101,18 +101,18 @@ module Echo_cli
101
101
  Helper.new.unset_envs()
102
102
  end
103
103
 
104
- desc "cpost", "Continuously post metrics to Echo. Use \"echo_cli cpost <URL> '<metric>' {frequency}\""
104
+ desc "cpost", "Continuously post metrics to Echo. Use \"echo_cli cpost <URL> '<metric>' {frequency} {-z}\""
105
105
 
106
106
  option :z
107
107
 
108
108
  long_desc <<-LONGDESC
109
- `echo_cli cpost` will continuously post a metric directly to Echo's StatsD server.
109
+ `echo_cli cpost` will continuously post a metric directly to Echo's StatsD server. This process can be killed with "CTRL-c".
110
110
 
111
111
  You can optionally specify a third integer parameter, which will post the metric to Echo at a frequency equal to the integer, in seconds. This value is set to '10 seconds' as the default continuous post frequency.
112
112
 
113
113
  Ensure single-quotes surround the metric.
114
114
 
115
- With -z (zombie) option, cpost will continuously send posts to Echo in the background, and return its PID for future removal.
115
+ With -z (zombie) option, cpost will continuously send posts to Echo in the background, and return its PID for future removal. Use "$ kill -9 <PID>" to kill the zombie process.
116
116
 
117
117
  > $ echo_cli cpost https://localhost:8125/metrix 'example.post:1|c' {1} {-z}
118
118
  LONGDESC
@@ -148,6 +148,7 @@ module Echo_cli
148
148
  end
149
149
  puts "Process ID: " + pid.to_s
150
150
  else
151
+ puts "\nPosting: ".green + metric.yellow + " once every ".green + s.to_s.yellow + " seconds".green + " to ".green + statsd_uri.yellow + "\nPress Ctrl-c to kill the process.\n".green
151
152
  while true do
152
153
  Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
153
154
  http.request(request)
@@ -1,3 +1,3 @@
1
1
  module Echo_cli
2
- VERSION = "0.6.18"
2
+ VERSION = "0.6.19"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: echo_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.18
4
+ version: 0.6.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Raphael