wavefront-sdk 2.2.1 → 2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a349786f62cf725f7507812e5fc4a46d58a3c068102c7276cb7d680cac72a6d
4
- data.tar.gz: bf493e285ec43adb60d7d21dfb1708c9eeab6018c177c8eb311b65779c7aaf46
3
+ metadata.gz: a02cb5dea9d85e5aedad5b0e90797ffd903e040599791e52797c65cf76915c23
4
+ data.tar.gz: 14e6c880b1c010955bf11bb878835d957d7c751c63ba6b64214181dbb17ab39d
5
5
  SHA512:
6
- metadata.gz: bf55a3a220fb68ce4a0312dc750012c585baf286ed3fec04445f859d7a95b9c8003c5fc78ed5a5916f3104fa4bea0ffef1c6610688186675e9e8874640d03eab
7
- data.tar.gz: b567bc3ede851020424080891dfdc744d1c3b31efe2abc6eb8ee7d3184ffcb7ec0dd8796ee4b5b818d3e70a53094da3352c25e2619f5d244a48af2df9657544f
6
+ metadata.gz: 7fcc872018be55b82240eb3df41eab15c4439894bd657e50d7d11d4be7f8a9b3d663aca4a0007921b269b78c1b1a64cf842bb9a4ef07268012c861cb4a5b1949
7
+ data.tar.gz: 0ad071bda2318a32541b7d97dc98314c8e47efe0100ba7d1eed868519c66bc3b07b228ee80a5888b9bd29d9dc33debb11367171afd5a5dbead6768789b6905fd
data/.travis.yml CHANGED
@@ -1,11 +1,12 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
- - 2.2.10
5
- - 2.3.7
6
- - 2.4.4
7
- - 2.5.1
8
- before_install: gem install bundler --no-rdoc --no-ri
4
+ - 2.2.10
5
+ - 2.3.8
6
+ - 2.4.5
7
+ - 2.5.3
8
+ - 2.6.0
9
+ before_install: gem install bundler -v 1.17.3 --no-document
9
10
  deploy:
10
11
  provider: rubygems
11
12
  api_key:
@@ -14,7 +15,7 @@ deploy:
14
15
  on:
15
16
  tags: true
16
17
  repo: snltd/wavefront-sdk
17
- ruby: 2.5.1
18
+ ruby: 2.5.3
18
19
  notifications:
19
20
  email: false
20
21
  slack:
data/HISTORY.md CHANGED
@@ -1,9 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.3.0 (06/01/2019)
4
+ * When sending points via the API, send bundles of up to 100 points
5
+ with each `POST`, rather than a call per point.
6
+
3
7
  ## 2.2.1 (20/12/2018)
4
8
  * Fix typo in `Wavefront::Alert#affected_by_maintenance` method
5
9
  name.
6
- * Full `Wavfront::Alert` test coverage.
10
+ * Full `Wavefront::Alert` test coverage.
7
11
 
8
12
  ## 2.2.0 (15/12/2018)
9
13
 
@@ -222,19 +222,6 @@ module Wavefront
222
222
  # lovely simple methods. Note that these are constructions of
223
223
  # the SDK and do not actually correspond to the underlying API.
224
224
 
225
- # @return [Wavefront::Response] all currently firing alerts
226
- #
227
- def active
228
- firing
229
- end
230
-
231
- # @return [Wavefront::Response] all alerts currently in a
232
- # maintenance window.
233
- #
234
- def affected_by_maintenance
235
- in_maintenance
236
- end
237
-
238
225
  # @return [Wavefront::Response] all alerts which have an invalid
239
226
  # query.
240
227
  #
@@ -256,6 +243,7 @@ module Wavefront
256
243
  def firing
257
244
  alerts_in_state(:firing)
258
245
  end
246
+ alias active firing
259
247
 
260
248
  # @return [Wavefront::Response] all alerts currently in a
261
249
  # maintenance window.
@@ -263,6 +251,7 @@ module Wavefront
263
251
  def in_maintenance
264
252
  alerts_in_state(:in_maintenance)
265
253
  end
254
+ alias affected_by_maintenance in_maintenance
266
255
 
267
256
  # @return [Wavefront::Response] I honestly don't know what the
268
257
  # NONE state denotes, but this will fetch alerts which have
@@ -1 +1 @@
1
- WF_SDK_VERSION = '2.2.1'.freeze
1
+ WF_SDK_VERSION = '2.3.0'.freeze
@@ -28,10 +28,36 @@ module Wavefront
28
28
  'credentials must contain API token')
29
29
  end
30
30
 
31
+ def send_point(body)
32
+ _send_point(body)
33
+ summary.sent += body.size
34
+ true
35
+ rescue StandardError => e
36
+ summary.unsent += body.size
37
+ logger.log('WARNING: failed to send point(s).')
38
+ logger.log(e.to_s, :debug)
39
+ false
40
+ end
41
+
31
42
  private
32
43
 
33
- def _send_point(point)
34
- conn.post('/?f=wavefront', point, 'application/octet-stream')
44
+ def write_loop(points)
45
+ body = points.map do |p|
46
+ p[:ts] = p[:ts].to_i if p[:ts].is_a?(Time)
47
+ hash_to_wf(p)
48
+ end
49
+
50
+ send_point(body)
51
+ end
52
+
53
+ # Send points in batches of a hundred. I'm not sure exactly
54
+ # how much the API can cope with in a single call, so this
55
+ # might change.
56
+ #
57
+ def _send_point(body)
58
+ body.each_slice(100) do |p|
59
+ conn.post('/?f=wavefront', p.join("\n"), 'application/octet-stream')
60
+ end
35
61
  end
36
62
  end
37
63
  end
@@ -26,7 +26,7 @@ Gem::Specification.new do |gem|
26
26
  gem.add_dependency 'inifile', '~> 3.0'
27
27
  gem.add_dependency 'map', '~> 6.6'
28
28
 
29
- gem.add_development_dependency 'bundler', '~> 1.3'
29
+ gem.add_development_dependency 'bundler', '~> 1.17'
30
30
  gem.add_development_dependency 'minitest', '~> 5.11'
31
31
  gem.add_development_dependency 'rake', '~> 12.0'
32
32
  gem.add_development_dependency 'rubocop', '~> 0.54.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wavefront-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Fisher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-20 00:00:00.000000000 Z
11
+ date: 2019-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.3'
75
+ version: '1.17'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.3'
82
+ version: '1.17'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: minitest
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -305,7 +305,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
305
  - !ruby/object:Gem::Version
306
306
  version: '0'
307
307
  requirements: []
308
- rubygems_version: 3.0.0
308
+ rubygems_version: 3.0.2
309
309
  signing_key:
310
310
  specification_version: 4
311
311
  summary: SDK for Wavefront API v2