wavefront-sdk 5.4.1 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +1 -1
- data/.github/workflows/release.yml +37 -0
- data/.github/workflows/test.yml +23 -0
- data/.rubocop.yml +8 -6
- data/HISTORY.md +26 -0
- data/README.md +5 -5
- data/lib/wavefront-sdk/api_mixins/acl.rb +1 -1
- data/lib/wavefront-sdk/core/api.rb +1 -1
- data/lib/wavefront-sdk/core/api_caller.rb +2 -2
- data/lib/wavefront-sdk/core/exception.rb +58 -0
- data/lib/wavefront-sdk/credentials.rb +8 -8
- data/lib/wavefront-sdk/defs/version.rb +1 -1
- data/lib/wavefront-sdk/event.rb +70 -3
- data/lib/wavefront-sdk/metricspolicy.rb +57 -0
- data/lib/wavefront-sdk/query.rb +2 -0
- data/lib/wavefront-sdk/search.rb +2 -0
- data/lib/wavefront-sdk/spy.rb +22 -0
- data/lib/wavefront-sdk/support/parse_time.rb +1 -1
- data/lib/wavefront-sdk/user.rb +1 -1
- data/lib/wavefront-sdk/validators.rb +17 -2
- data/lib/wavefront-sdk/write.rb +3 -3
- data/lib/wavefront-sdk/writers/api.rb +2 -2
- data/lib/wavefront-sdk/writers/core.rb +1 -1
- data/lib/wavefront-sdk/writers/http.rb +2 -2
- data/lib/wavefront-sdk/writers/proxy.rb +71 -0
- data/lib/wavefront-sdk/writers/socket.rb +15 -27
- data/spec/.rubocop.yml +3 -15
- data/spec/constants.rb +2 -2
- data/spec/support/mocket.rb +3 -1
- data/spec/test_mixins/general.rb +1 -1
- data/spec/wavefront-sdk/core/response_spec.rb +2 -2
- data/spec/wavefront-sdk/event_spec.rb +46 -0
- data/spec/wavefront-sdk/metric_helper_spec.rb +6 -4
- data/spec/wavefront-sdk/metricspolicy_spec.rb +94 -0
- data/spec/wavefront-sdk/spy_spec.rb +27 -0
- data/spec/wavefront-sdk/validators_spec.rb +11 -1
- data/spec/wavefront-sdk/write_spec.rb +1 -1
- data/spec/wavefront-sdk/writers/api_spec.rb +4 -0
- data/spec/wavefront-sdk/writers/core_spec.rb +1 -3
- data/spec/wavefront-sdk/writers/http_spec.rb +24 -21
- data/spec/wavefront-sdk/writers/proxy_spec.rb +129 -0
- data/spec/wavefront-sdk/writers/socket_spec.rb +49 -27
- data/wavefront-sdk.gemspec +5 -3
- metadata +58 -11
- data/.github/workflows/ruby.yml +0 -32
- data/.travis.yml +0 -21
- data/lib/wavefront-sdk/writers/unix.rb +0 -59
@@ -6,24 +6,23 @@ require 'spy'
|
|
6
6
|
require 'spy/integration'
|
7
7
|
require 'socket'
|
8
8
|
require 'logger'
|
9
|
+
require_relative '../resources/dummy_points'
|
9
10
|
require_relative '../../spec_helper'
|
10
11
|
require_relative '../../../lib/wavefront-sdk/write'
|
11
|
-
require_relative '
|
12
|
+
require_relative '../../../spec/support/mocket'
|
13
|
+
|
14
|
+
UNIX_SOCK = '/tmp/testsock'
|
12
15
|
|
13
|
-
|
14
|
-
WS_CREDS = { proxy: 'wavefront-proxy' }
|
15
|
-
# rubocop:enable Style/MutableConstant
|
16
|
+
WU_CREDS = { socket: UNIX_SOCK }.freeze
|
16
17
|
|
17
|
-
#
|
18
|
-
# own. It makes far more sense to test the Write interface which
|
19
|
-
# calls it.
|
18
|
+
# Test UNIX Datagram socket writing
|
20
19
|
#
|
21
|
-
class
|
20
|
+
class WavefrontWriterUnixTest < MiniTest::Test
|
22
21
|
attr_reader :wf, :wf_noop
|
23
22
|
|
24
23
|
def setup
|
25
|
-
@wf = Wavefront::Write.new(
|
26
|
-
@wf_noop = Wavefront::Write.new(
|
24
|
+
@wf = Wavefront::Write.new(WU_CREDS, writer: :socket)
|
25
|
+
@wf_noop = Wavefront::Write.new(WU_CREDS, writer: :socket, noop: true)
|
27
26
|
end
|
28
27
|
|
29
28
|
def test_writer_class
|
@@ -32,16 +31,16 @@ class WavefrontWriterSocketTest < MiniTest::Test
|
|
32
31
|
|
33
32
|
def test_write_openclose
|
34
33
|
mocket = Mocket.new
|
35
|
-
Spy.on(
|
36
|
-
mocket_spy = Spy.on(mocket, :
|
34
|
+
Spy.on(UNIXSocket, :new).and_return(mocket)
|
35
|
+
mocket_spy = Spy.on(mocket, :write)
|
37
36
|
wf.write(POINT)
|
38
37
|
assert mocket_spy.has_been_called?
|
39
38
|
end
|
40
39
|
|
41
40
|
def test_write_noop
|
42
41
|
mocket = Mocket.new
|
43
|
-
Spy.on(
|
44
|
-
mocket_spy = Spy.on(mocket, :
|
42
|
+
Spy.on(UNIXSocket, :new).and_return(mocket)
|
43
|
+
mocket_spy = Spy.on(mocket, :write)
|
45
44
|
wf_noop.open
|
46
45
|
wf_noop.write(POINT, false)
|
47
46
|
refute mocket_spy.has_been_called?
|
@@ -49,16 +48,16 @@ class WavefrontWriterSocketTest < MiniTest::Test
|
|
49
48
|
|
50
49
|
def test_write_noop_openclose
|
51
50
|
mocket = Mocket.new
|
52
|
-
Spy.on(
|
53
|
-
mocket_spy = Spy.on(mocket, :
|
51
|
+
Spy.on(UNIXSocket, :new).and_return(mocket)
|
52
|
+
mocket_spy = Spy.on(mocket, :write)
|
54
53
|
wf_noop.write(POINT)
|
55
54
|
refute mocket_spy.has_been_called?
|
56
55
|
end
|
57
56
|
|
58
57
|
def test_write
|
59
58
|
mocket = Mocket.new
|
60
|
-
Spy.on(
|
61
|
-
mocket_spy = Spy.on(mocket, :
|
59
|
+
Spy.on(UNIXSocket, :new).and_return(mocket)
|
60
|
+
mocket_spy = Spy.on(mocket, :write)
|
62
61
|
wf.open
|
63
62
|
wf.write(POINT, false)
|
64
63
|
assert mocket_spy.has_been_called?
|
@@ -66,8 +65,8 @@ class WavefrontWriterSocketTest < MiniTest::Test
|
|
66
65
|
|
67
66
|
def test_write_array
|
68
67
|
mocket = Mocket.new
|
69
|
-
Spy.on(
|
70
|
-
mocket_spy = Spy.on(mocket, :
|
68
|
+
Spy.on(UNIXSocket, :new).and_return(mocket)
|
69
|
+
mocket_spy = Spy.on(mocket, :write)
|
71
70
|
wf.open
|
72
71
|
wf.write(POINT_A, false)
|
73
72
|
assert mocket_spy.has_been_called?
|
@@ -75,35 +74,58 @@ class WavefrontWriterSocketTest < MiniTest::Test
|
|
75
74
|
|
76
75
|
def test_noop_send_point
|
77
76
|
mocket = Mocket.new
|
78
|
-
Spy.on(
|
79
|
-
mocket_spy = Spy.on(mocket, :
|
77
|
+
Spy.on(UNIXSocket, :new).and_return(mocket)
|
78
|
+
mocket_spy = Spy.on(mocket, :write)
|
80
79
|
wf_noop.open
|
81
80
|
wf_noop.send_point(POINT_L)
|
82
81
|
refute mocket_spy.has_been_called?
|
83
82
|
end
|
84
83
|
|
85
84
|
def test_open
|
86
|
-
tcp_spy = Spy.on(
|
85
|
+
tcp_spy = Spy.on(UNIXSocket, :new)
|
87
86
|
wf.open
|
88
87
|
assert tcp_spy.has_been_called?
|
89
|
-
assert_equal([
|
88
|
+
assert_equal([UNIX_SOCK], tcp_spy.calls.first.args)
|
90
89
|
end
|
91
90
|
|
92
91
|
def test_noop_open
|
93
|
-
tcp_spy = Spy.on(
|
92
|
+
tcp_spy = Spy.on(UNIXSocket, :new)
|
94
93
|
log_spy = Spy.on(wf_noop.logger, :log)
|
95
94
|
wf_noop.open
|
96
95
|
refute tcp_spy.has_been_called?
|
97
|
-
assert_equal(['No-op requested. Not opening connection
|
96
|
+
assert_equal(['No-op requested. Not opening socket connection.'],
|
98
97
|
log_spy.calls.last.args)
|
99
98
|
assert_equal(1, log_spy.calls.size)
|
100
99
|
end
|
101
100
|
|
102
101
|
def test_noop_close
|
103
|
-
tcp_spy = Spy.on(
|
102
|
+
tcp_spy = Spy.on(UNIXSocket, :new)
|
104
103
|
log_spy = Spy.on(wf_noop.logger, :log)
|
105
104
|
wf_noop.close
|
106
105
|
refute tcp_spy.has_been_called?
|
107
106
|
refute log_spy.has_been_called?
|
108
107
|
end
|
108
|
+
|
109
|
+
def test_validate_credentials
|
110
|
+
assert(Wavefront::Write.new(WU_CREDS, writer: :socket))
|
111
|
+
|
112
|
+
assert_instance_of(Wavefront::Write,
|
113
|
+
Wavefront::Write.new(WU_CREDS, writer: :socket))
|
114
|
+
|
115
|
+
assert_raises(Wavefront::Exception::CredentialError) do
|
116
|
+
Wavefront::Write.new({}, writer: :socket)
|
117
|
+
end
|
118
|
+
|
119
|
+
assert_raises(Wavefront::Exception::CredentialError) do
|
120
|
+
Wavefront::Write.new({ endpoint: 'wavefront.com' }, writer: :socket)
|
121
|
+
end
|
122
|
+
|
123
|
+
assert_raises(Wavefront::Exception::CredentialError) do
|
124
|
+
Wavefront::Write.new({ token: 'abcdef' }, writer: :socket)
|
125
|
+
end
|
126
|
+
|
127
|
+
assert_raises(Wavefront::Exception::CredentialError) do
|
128
|
+
Wavefront::Write.new({ proxy: nil }, writer: :socket)
|
129
|
+
end
|
130
|
+
end
|
109
131
|
end
|
data/wavefront-sdk.gemspec
CHANGED
@@ -7,7 +7,6 @@ require_relative 'lib/wavefront-sdk/defs/version'
|
|
7
7
|
Gem::Specification.new do |gem|
|
8
8
|
gem.name = 'wavefront-sdk'
|
9
9
|
gem.version = WF_SDK_VERSION
|
10
|
-
gem.date = Date.today.to_s
|
11
10
|
|
12
11
|
gem.summary = 'SDK for Wavefront API v2'
|
13
12
|
gem.description = 'SDK for Wavefront (wavefront.com) API v2 '
|
@@ -29,11 +28,14 @@ Gem::Specification.new do |gem|
|
|
29
28
|
|
30
29
|
gem.add_development_dependency 'minitest', '~> 5.14'
|
31
30
|
gem.add_development_dependency 'rake', '~> 13.0'
|
32
|
-
gem.add_development_dependency 'rubocop', '1.
|
31
|
+
gem.add_development_dependency 'rubocop', '~> 1.17'
|
32
|
+
gem.add_development_dependency 'rubocop-minitest', '~> 0.10'
|
33
|
+
gem.add_development_dependency 'rubocop-performance', '~> 1.3'
|
34
|
+
gem.add_development_dependency 'rubocop-rake', '~> 0.5'
|
33
35
|
gem.add_development_dependency 'simplecov', '~> 0.18'
|
34
36
|
gem.add_development_dependency 'spy', '1.0.0'
|
35
37
|
gem.add_development_dependency 'webmock', '~> 3.9'
|
36
38
|
gem.add_development_dependency 'yard', '~> 0.9'
|
37
39
|
|
38
|
-
gem.required_ruby_version = Gem::Requirement.new('>= 2.
|
40
|
+
gem.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
|
39
41
|
end
|
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:
|
4
|
+
version: 6.0.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:
|
11
|
+
date: 2021-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -98,16 +98,58 @@ dependencies:
|
|
98
98
|
name: rubocop
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '1.
|
103
|
+
version: '1.17'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.17'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-minitest
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.10'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.10'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-performance
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.3'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.3'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop-rake
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.5'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
109
151
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
152
|
+
version: '0.5'
|
111
153
|
- !ruby/object:Gem::Dependency
|
112
154
|
name: simplecov
|
113
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,10 +213,10 @@ extensions: []
|
|
171
213
|
extra_rdoc_files: []
|
172
214
|
files:
|
173
215
|
- ".codeclimate.yml"
|
174
|
-
- ".github/workflows/
|
216
|
+
- ".github/workflows/release.yml"
|
217
|
+
- ".github/workflows/test.yml"
|
175
218
|
- ".gitignore"
|
176
219
|
- ".rubocop.yml"
|
177
|
-
- ".travis.yml"
|
178
220
|
- Gemfile
|
179
221
|
- HISTORY.md
|
180
222
|
- LICENSE.txt
|
@@ -206,6 +248,7 @@ files:
|
|
206
248
|
- lib/wavefront-sdk/message.rb
|
207
249
|
- lib/wavefront-sdk/metric.rb
|
208
250
|
- lib/wavefront-sdk/metric_helper.rb
|
251
|
+
- lib/wavefront-sdk/metricspolicy.rb
|
209
252
|
- lib/wavefront-sdk/notificant.rb
|
210
253
|
- lib/wavefront-sdk/paginator/base.rb
|
211
254
|
- lib/wavefront-sdk/paginator/delete.rb
|
@@ -241,9 +284,9 @@ files:
|
|
241
284
|
- lib/wavefront-sdk/writers/api.rb
|
242
285
|
- lib/wavefront-sdk/writers/core.rb
|
243
286
|
- lib/wavefront-sdk/writers/http.rb
|
287
|
+
- lib/wavefront-sdk/writers/proxy.rb
|
244
288
|
- lib/wavefront-sdk/writers/socket.rb
|
245
289
|
- lib/wavefront-sdk/writers/summary.rb
|
246
|
-
- lib/wavefront-sdk/writers/unix.rb
|
247
290
|
- lib/wavefront_sdk.rb
|
248
291
|
- spec/.rubocop.yml
|
249
292
|
- spec/constants.rb
|
@@ -276,6 +319,7 @@ files:
|
|
276
319
|
- spec/wavefront-sdk/message_spec.rb
|
277
320
|
- spec/wavefront-sdk/metric_helper_spec.rb
|
278
321
|
- spec/wavefront-sdk/metric_spec.rb
|
322
|
+
- spec/wavefront-sdk/metricspolicy_spec.rb
|
279
323
|
- spec/wavefront-sdk/misc_spec.rb
|
280
324
|
- spec/wavefront-sdk/notificant_spec.rb
|
281
325
|
- spec/wavefront-sdk/paginator/base_spec.rb
|
@@ -315,6 +359,7 @@ files:
|
|
315
359
|
- spec/wavefront-sdk/writers/api_spec.rb
|
316
360
|
- spec/wavefront-sdk/writers/core_spec.rb
|
317
361
|
- spec/wavefront-sdk/writers/http_spec.rb
|
362
|
+
- spec/wavefront-sdk/writers/proxy_spec.rb
|
318
363
|
- spec/wavefront-sdk/writers/socket_spec.rb
|
319
364
|
- spec/wavefront-sdk/writers/summary_spec.rb
|
320
365
|
- wavefront-sdk.gemspec
|
@@ -330,14 +375,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
330
375
|
requirements:
|
331
376
|
- - ">="
|
332
377
|
- !ruby/object:Gem::Version
|
333
|
-
version: 2.
|
378
|
+
version: 2.5.0
|
334
379
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
335
380
|
requirements:
|
336
381
|
- - ">="
|
337
382
|
- !ruby/object:Gem::Version
|
338
383
|
version: '0'
|
339
384
|
requirements: []
|
340
|
-
rubygems_version: 3.
|
385
|
+
rubygems_version: 3.1.6
|
341
386
|
signing_key:
|
342
387
|
specification_version: 4
|
343
388
|
summary: SDK for Wavefront API v2
|
@@ -373,6 +418,7 @@ test_files:
|
|
373
418
|
- spec/wavefront-sdk/message_spec.rb
|
374
419
|
- spec/wavefront-sdk/metric_helper_spec.rb
|
375
420
|
- spec/wavefront-sdk/metric_spec.rb
|
421
|
+
- spec/wavefront-sdk/metricspolicy_spec.rb
|
376
422
|
- spec/wavefront-sdk/misc_spec.rb
|
377
423
|
- spec/wavefront-sdk/notificant_spec.rb
|
378
424
|
- spec/wavefront-sdk/paginator/base_spec.rb
|
@@ -412,5 +458,6 @@ test_files:
|
|
412
458
|
- spec/wavefront-sdk/writers/api_spec.rb
|
413
459
|
- spec/wavefront-sdk/writers/core_spec.rb
|
414
460
|
- spec/wavefront-sdk/writers/http_spec.rb
|
461
|
+
- spec/wavefront-sdk/writers/proxy_spec.rb
|
415
462
|
- spec/wavefront-sdk/writers/socket_spec.rb
|
416
463
|
- spec/wavefront-sdk/writers/summary_spec.rb
|
data/.github/workflows/ruby.yml
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
2
|
-
# They are provided by a third-party and are governed by
|
3
|
-
# separate terms of service, privacy policy, and support
|
4
|
-
# documentation.
|
5
|
-
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
-
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
-
|
8
|
-
name: Ruby
|
9
|
-
|
10
|
-
on:
|
11
|
-
push:
|
12
|
-
branches: [ master ]
|
13
|
-
pull_request:
|
14
|
-
branches: [ master ]
|
15
|
-
|
16
|
-
jobs:
|
17
|
-
test:
|
18
|
-
runs-on: ubuntu-latest
|
19
|
-
strategy:
|
20
|
-
matrix:
|
21
|
-
ruby-version: [2.4.10, 2.5.8, 2.6.6, 2.7.2]
|
22
|
-
steps:
|
23
|
-
- uses: actions/checkout@v2
|
24
|
-
- name: Set up Ruby
|
25
|
-
uses: ruby/setup-ruby@v1
|
26
|
-
with:
|
27
|
-
ruby-version: ${{ matrix.ruby-version }}
|
28
|
-
bundler-cache: true
|
29
|
-
- name: Install dependencies
|
30
|
-
run: bundle install
|
31
|
-
- name: Run tests
|
32
|
-
run: bundle exec rake
|
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
rvm:
|
4
|
-
- 2.4.9
|
5
|
-
- 2.5.8
|
6
|
-
- 2.6.6
|
7
|
-
- 2.7.2
|
8
|
-
before_install: gem install bundler --no-document
|
9
|
-
deploy:
|
10
|
-
provider: rubygems
|
11
|
-
api_key:
|
12
|
-
secure: dfmL5JwBn+u3cUmyAaDsApDa7ljGajGNz3GDcKd2J8FOt7+a758/lmL8EQ34sDT1ZFotrxn/y1RbgXlaDxAE1XDfrZbjckmx7a6wa2sqR3kBraJ2tx7CiXodbw3Z8XZf9WLb0kYGmlLtI73GNcuunMt/9f1cobqWISRLHw6b7amlO7GW2ZBZgzRS+N8TSS2dicIvKMo5HoMYU+uWLM4zDFBPnGNcMiWxh8ysLzJoKqA9kbBUyCVEZ03MlV7G71ObvWCLasKnZ3W5U+K1NbgU7mgMYfl9KIcA4y9hQ9hUCijk40SmT7ffy3P2gq8zblC/4x5Eefpau9X/bdLwXoRCIzqk05t4f45wstj2auHGK0HJwOYRtx8apdaLSgyJ5lQpGcbCRu40WR9mDkaM8m9n3u2o6GJmftCg3AN1QtsourmQB84x67LEbHzValMaokrbCol4XeWqlC+dCNLPixemQRBvcNfI3V9C6RqVGfjpoGlSTI+RkQqwm01PcxpeqIVfdMd1wnfUuAOywUO6UpvtK9TZaxg0NnVElXpPseQbtzulLwZ7R5Y3A4Ss8Z7w43c1KHxTkg54FWUOp065ItjAc4lmyORXq/2+F7sMvRN6dtCLaXTUlkYuU3cjFLIPlLGFYgqq4T4xQa+e5NEK1XW7nghv+IRfKfyVeZsB0WpY+uc=
|
13
|
-
gem: wavefront-sdk
|
14
|
-
on:
|
15
|
-
tags: true
|
16
|
-
repo: snltd/wavefront-sdk
|
17
|
-
ruby: 2.6.6
|
18
|
-
notifications:
|
19
|
-
email: false
|
20
|
-
slack:
|
21
|
-
secure: cTG5e5NsnfZCNF6mUbnz8rdxmiPvrihJJN/7vEltO6rSCR4ew+9dfga9n7N5wCu7nae3lEysbRw7vPw605VVkZrfA4gn+HUsoHbKzaKNOB6AV9a8kkbjC4y6MH7EWSD2qsUWeeINP7dNs80cqvEwU2tgtIiBWNAP+e/eCjTEQCq4UIXnEB0f0UIP4bvl3w7/fSd0iFykBiVTiXvGBWKkqbetSAcAvsV5wxbPGqrhBp5AQQ9izm0Uh/P/hv8gaqMariFYA6rIpunWmwxPCHf3B87CTdl6T8uC5bi4bfgb3mFbQUiP9TTblz2XTI3Q9tRDbcFcr4BGpjB1Lyfdy1puRi3QzP5VME5AXvDTr9GVgi9TS6EWqy7P4HC//qZziWllTLlst6R9r/NlagTsiDB/mcnxkJBvOBYAvmzXS5ID6DfNxx/xCfCZuQzp5ISoWawGCvuGHBSOlzZZXKD4AAT8/69SIVybM23Hj/YBPKVvR9brpCmIlK4YXi14SA5sInjD4zn20u/p22vlEybjlnM8td7ryuhmCYm1ptk8y0tZ4oRoK2fBNo2VTD73aXq6P2q3AKuT6A9hRbypEJgawNgOAKJEWDHdu29LfeJIUnm25MzaFzx145it2hDU2/hOUlpFq9QKsmR2pAiI17sAMgHJ15cgaeOv1soWaYJsMOZil74=
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'socket'
|
4
|
-
require_relative 'core'
|
5
|
-
|
6
|
-
module Wavefront
|
7
|
-
module Writer
|
8
|
-
#
|
9
|
-
# Everything specific to writing points to a Unix datagram
|
10
|
-
# socket.
|
11
|
-
#
|
12
|
-
class Unix < Core
|
13
|
-
# Make a connection to a Unix datagram socket, putting the
|
14
|
-
# descriptor in instance variable @conn.
|
15
|
-
# This requires the name of the socket file in creds[:socket]
|
16
|
-
# @return [UnixSocket]
|
17
|
-
#
|
18
|
-
def open
|
19
|
-
if opts[:noop]
|
20
|
-
logger.log('No-op requested. Not opening socket connection.')
|
21
|
-
return true
|
22
|
-
end
|
23
|
-
|
24
|
-
logger.log("Connecting to #{creds[:socket]}.", :debug)
|
25
|
-
open_socket(creds[:socket])
|
26
|
-
end
|
27
|
-
|
28
|
-
def close
|
29
|
-
return if opts[:noop]
|
30
|
-
|
31
|
-
logger.log('Closing socket connection.', :debug)
|
32
|
-
conn.close
|
33
|
-
end
|
34
|
-
|
35
|
-
def validate_credentials(creds)
|
36
|
-
return true if creds.key?(:socket)
|
37
|
-
|
38
|
-
raise(Wavefront::Exception::CredentialError,
|
39
|
-
'creds must contain socket file path')
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
def open_socket(socket)
|
45
|
-
@conn = UNIXSocket.new(socket)
|
46
|
-
rescue StandardError => e
|
47
|
-
logger.log(e, :error)
|
48
|
-
raise Wavefront::Exception::InvalidEndpoint
|
49
|
-
end
|
50
|
-
|
51
|
-
# @param point [String] point or points in native Wavefront
|
52
|
-
# format.
|
53
|
-
#
|
54
|
-
def _send_point(point)
|
55
|
-
conn.write(point)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|