wavefront-client 3.3.1 → 3.4.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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzlmYWM4Y2YyZjljNjE0OTVmNjRlZmU5NDU5YTI1ZWY0MDM1YWUyOQ==
4
+ ZDFjYTkzZTY4OGIzM2JlYTJiYmZmMGU0NjQzYjVmYTY1Y2MyZTBlOA==
5
5
  data.tar.gz: !binary |-
6
- NmZhNGMyYmZkYjY1NzgwZjI5OTYxMzI4YmVjYjYxNTBhMzEwNzg0MA==
6
+ MjBhZjI0MzA5NjdhNDhlZmU4OTBkN2E1MjVmNmYxZDA2MWNhN2YwMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmE0OTFjMGU3M2ZiOTFmNDFiNjBhOTZhYTNhZDZiM2JkYTEzZGJhNjkzMDdl
10
- YzFmODUyMDRmNDVmMGFlYjMzMTgzODFhM2I5MTc3ZDMwYWEyYzgwOTBhZDA1
11
- ODI3OTI3OGMzODIzZTYwNjMxMWY5Zjc5ZTM3OGQ5YTliMDRhZjg=
9
+ Nzc4MWJhMzNiYjAzZmYzYTYyYWRlNTQ4OTBjNzI2ZDg0YmVkMTdhYjNlYjNj
10
+ MjM2MjEzMmQzNzFiYjI3YjQ1Y2FjZTlhYTFlODlhODg4Yjk5NjFhNTI4NzU1
11
+ YjBhMWU3ODA4M2EzZTZiNWYyZTMwNWRhMTY4NDM4MzE2OGE1YzY=
12
12
  data.tar.gz: !binary |-
13
- MWFlN2NhZTc2YzNmMzY1MGFhOGI3YTY2NTM0NGJiZGY2NjQxMmUwNDBkNmMx
14
- OGYwYzExOGFhZmQ0M2YzNmYzMDYyNTM5ZjI3Njc1NTIwMDA5NGFjYWY2MTM5
15
- N2ExY2M4ZWRiOWRkZDI1YmJmMmJhMTAyNWFiMjMxY2UxMjBjMmQ=
13
+ MjQ3MDIzNzRhZTYwZGMwM2FlMjM3N2FjN2UzODg3OGQxNWYxMGY3ZDM3ZDc5
14
+ OGQ0NGRjYjY1NmUxZDYxODJkYjg5NmU3MzQ3NTRkNzY5NzYxY2YyNDdmMzRj
15
+ NDlmZGM3YWM5ZmU2YTMxOGFiMzk3MzRkM2E2MmE5MzA4MzZkYjU=
data/README-cli.md CHANGED
@@ -165,6 +165,7 @@ Usage:
165
165
  [-H host] [-n] <event>
166
166
  wavefront event close [-V] [-c file] [-P profile] [-E endpoint] [-t token]
167
167
  [<event>] [<timestamp>]
168
+ wavefront event delete [-V] <timestamp> <event>
168
169
  wavefront event show
169
170
  wavefront event --help
170
171
 
@@ -199,6 +200,11 @@ close <name>`, which will close the last event opened and called `name`.
199
200
  You can also specify the open-time when closing and event, bypassing
200
201
  the local caching mechanism altogether.
201
202
 
203
+ When deleting an event you must supply the timestamp in epoch-milliseconds.
204
+ This level of precision is required by Wavefront's API, and it is
205
+ troublesome for the user to supply millisecond-accurate timestamps in any
206
+ other format.
207
+
202
208
  The `wavefront event show` command lists the cached events. To
203
209
  properly query events, use the `events()` command in a `ts` query.
204
210
 
@@ -241,6 +247,12 @@ Closing event 'puppet_run'. [2016-06-27 19:25:16 +0100]
241
247
  Removing state file /var/tmp/wavefront/events/rob/1467051916712::puppet_run.
242
248
  ```
243
249
 
250
+ Delete an event created in error.
251
+
252
+ ```
253
+ $ wavefront delete 1476187357169 some_event
254
+ ```
255
+
244
256
  ## `write` Mode: Sending Points to Wavefront
245
257
 
246
258
  The `write` command is used to put data points into Wavefront. It is
data/bin/wavefront CHANGED
@@ -103,6 +103,7 @@ Usage:
103
103
  [-H host] [-n] <event>
104
104
  #{ME} event close [-V] [-c file] [-P profile] [-E endpoint] [-t token]
105
105
  [<event>] [<timestamp>]
106
+ #{ME} event delete [-V] <timestamp> <event>
106
107
  #{ME} event show
107
108
  #{ME} event --help
108
109
  #{global_opts}
@@ -52,11 +52,35 @@ class Wavefront::Cli::Events < Wavefront::Cli
52
52
  close_event_handler
53
53
  elsif options[:show]
54
54
  show_open_events
55
+ elsif options[:delete]
56
+ delete_event
55
57
  else
56
58
  fail 'undefined event error.'
57
59
  end
58
60
  end
59
61
 
62
+ def delete_event
63
+ unless options[:'<timestamp>'] && options[:'<event>']
64
+ fail 'To delete an event you must supply its start time and name.'
65
+ end
66
+
67
+ begin
68
+ response = wf_event.delete({
69
+ startTime: options[:'<timestamp>'],
70
+ name: options[:'<event>'],
71
+ })
72
+ rescue RestClient::Unauthorized
73
+ raise 'Cannot connect to Wavefront API.'
74
+ rescue RestClient::ResourceNotFound
75
+ raise 'Cannot find that event.'
76
+ rescue => e
77
+ puts e
78
+ raise 'Cannot delete event.'
79
+ end
80
+
81
+ puts "Deleted event."
82
+ end
83
+
60
84
  def prep_time(t)
61
85
  #
62
86
  # Wavefront would like times in epoch milliseconds, so whatever
@@ -166,7 +190,11 @@ class Wavefront::Cli::Events < Wavefront::Cli
166
190
  # Everything we need to know about an event is in the name of
167
191
  # its state file.
168
192
  #
169
- events = state_dir.children
193
+ begin
194
+ events = state_dir.children
195
+ rescue Errno::ENOENT
196
+ raise 'There is no event state directory on this host.'
197
+ end
170
198
 
171
199
  if events.length == 0
172
200
  puts 'No open events.'
@@ -16,6 +16,6 @@ See the License for the specific language governing permissions and
16
16
 
17
17
  module Wavefront
18
18
  class Client
19
- VERSION = "3.3.1"
19
+ VERSION = "3.4.0"
20
20
  end
21
21
  end
@@ -35,6 +35,17 @@ module Wavefront
35
35
  make_call(close_uri(options), hash_to_qs(payload))
36
36
  end
37
37
 
38
+ def delete(payload = {}, options = {})
39
+ unless payload.has_key?(:startTime) && payload.has_key?(:name)
40
+ raise 'invalid payload'
41
+ end
42
+
43
+ uri = create_uri(path: [DEFAULT_PATH, payload[:startTime],
44
+ payload[:name]].join('/').squeeze('/'))
45
+
46
+ RestClient.delete(uri.to_s, headers)
47
+ end
48
+
38
49
  def create_uri(options = {})
39
50
  #
40
51
  # Build the URI we use to send a 'create' request.
@@ -24,8 +24,8 @@ Gem::Specification.new do |spec|
24
24
  spec.version = Wavefront::Client::VERSION
25
25
  spec.authors = ["Sam Pointer", "Louis McCormack", "Joshua McGhee", "Conor Beverland", "Salil Deshmukh", "Rob Fisher"]
26
26
  spec.email = ["support@wavefront.com"]
27
- spec.description = %q{A simple abstraction for talking to wavefront in ruby}
28
- spec.summary = %q{A simple abstraction for talking to wavefront in ruby}
27
+ spec.description = %q{A simple abstraction for talking to Wavefront in Ruby. Includes a command-line interface.}
28
+ spec.summary = %q{A simple abstraction for talking to Wavefront in Ruby}
29
29
  spec.homepage = "https://github.com/wavefrontHQ/ruby-client"
30
30
  spec.license = "Apache License 2.0"
31
31
 
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
38
38
  spec.add_development_dependency "rake"
39
39
  spec.add_development_dependency "rspec", "~> 3.5.0"
40
40
 
41
- spec.add_dependency "rest-client", ">= 1.6.7", "<= 1.8"
41
+ spec.add_dependency "rest-client", ">= 1.6.7", "< 1.8"
42
42
  spec.add_dependency "docopt", "~> 0.5.0"
43
43
  spec.add_dependency 'inifile', '3.0.0'
44
44
  spec.required_ruby_version = Gem::Requirement.new(">= 1.9.3")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wavefront-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.1
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Pointer
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2016-08-24 00:00:00.000000000 Z
16
+ date: 2016-10-19 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: bundler
@@ -64,7 +64,7 @@ dependencies:
64
64
  - - ! '>='
65
65
  - !ruby/object:Gem::Version
66
66
  version: 1.6.7
67
- - - <=
67
+ - - <
68
68
  - !ruby/object:Gem::Version
69
69
  version: '1.8'
70
70
  type: :runtime
@@ -74,7 +74,7 @@ dependencies:
74
74
  - - ! '>='
75
75
  - !ruby/object:Gem::Version
76
76
  version: 1.6.7
77
- - - <=
77
+ - - <
78
78
  - !ruby/object:Gem::Version
79
79
  version: '1.8'
80
80
  - !ruby/object:Gem::Dependency
@@ -105,7 +105,8 @@ dependencies:
105
105
  - - '='
106
106
  - !ruby/object:Gem::Version
107
107
  version: 3.0.0
108
- description: A simple abstraction for talking to wavefront in ruby
108
+ description: A simple abstraction for talking to Wavefront in Ruby. Includes a command-line
109
+ interface.
109
110
  email:
110
111
  - support@wavefront.com
111
112
  executables:
@@ -185,7 +186,7 @@ rubyforge_project:
185
186
  rubygems_version: 2.4.5
186
187
  signing_key:
187
188
  specification_version: 4
188
- summary: A simple abstraction for talking to wavefront in ruby
189
+ summary: A simple abstraction for talking to Wavefront in Ruby
189
190
  test_files:
190
191
  - spec/example_response.json
191
192
  - spec/spec_helper.rb