signalfx 2.0.5 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1cec7a5de514b8432cd66c22f331d2fb4fd14ed
4
- data.tar.gz: bd426b759f14b86519cf7c932816fca1f54ff107
3
+ metadata.gz: f4d9b5d2fd10a70d0b431b6e6d4200e3f4634ff5
4
+ data.tar.gz: 711835760cb429f574c776435eba20a46b45afa1
5
5
  SHA512:
6
- metadata.gz: edc96a9293d8d1361c8f6726bf7b44c3522c9a13d4d3d2dd9c1d583349bed2762589ab133e502d7e814ee5aec9c3712bd4f61b9bf2b45eba66590730cee67f2b
7
- data.tar.gz: 436e10fdca7a8f89624ff59938af0ee226cd8a1d8f08f95ffdcf11435f48eafcd0916ba07eeb0678fb8a3cc1b87610287085c4a0e8e772e5e6808c2dcad0e2d2
6
+ metadata.gz: c9ab6fa6dc20607bb4516534e674206af91bb8ffd7304e2b579a36cbcb1cd85dc23e0b2e25620bec371738b90d4dedb00bc5af22bf7871370167b8470d74f739
7
+ data.tar.gz: 9f3d726b842f389cc7e5732b3124d376898cd5639fe657133420c6633bf3ee811c82d139ea4261726f7440842fc98a421819ca3bcd343f6382a21d388212168b
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- signalfx (2.0.5)
4
+ signalfx (2.1.0)
5
5
  activesupport (>= 3.2)
6
6
  protobuf (>= 3.5.1)
7
7
  rest-client (~> 2.0)
data/README.md CHANGED
@@ -55,7 +55,7 @@ Optional constructor parameters:
55
55
  deployed on Amazon AWS.
56
56
  + **ingest_endpoint** (string): to override the target ingest API
57
57
  endpoint.
58
- + **api_endpoint** (string): to override the target REST API endpoint.
58
+ + **stream_endpoint** (string): to override the target stream endpoint for SignalFlow.
59
59
  + **timeout** (number): timeout, in seconds, for requests to SignalFx.
60
60
  + **batch_size** (number): size of datapoint batches to send to
61
61
  SignalFx.
@@ -16,31 +16,35 @@ module SignalFx
16
16
  # and set it as `AWSUniqueId` dimension for each datapoint and event.
17
17
  # Use this option only if your application deployed to Amazon
18
18
  # @param ingest_endpoint - string
19
- # @param api_endpoint - string
19
+ # @param stream_endpoint - string
20
20
  # @param timeout - number
21
21
  # @param batch_size - number
22
22
  # @param user_agents - array
23
23
  def self.new(api_token,
24
24
  enable_aws_unique_id: false,
25
25
  ingest_endpoint: RbConfig::DEFAULT_INGEST_ENDPOINT,
26
+ stream_endpoint: RbConfig::DEFAULT_STREAM_ENDPOINT,
26
27
  timeout: RbConfig::DEFAULT_TIMEOUT,
27
28
  batch_size: RbConfig::DEFAULT_BATCH_SIZE,
28
- user_agents: [])
29
+ user_agents: [],
30
+ logger: Logger.new(STDOUT, progname: "signalfx"))
29
31
  begin
30
32
  require_relative './proto/signal_fx_protocol_buffers.pb'
31
33
  ProtoBufSignalFx.new(api_token,
32
34
  enable_aws_unique_id: enable_aws_unique_id,
33
35
  ingest_endpoint: ingest_endpoint,
36
+ stream_endpoint: stream_endpoint,
34
37
  timeout: timeout,
35
38
  batch_size: batch_size,
36
39
  user_agents: user_agents)
37
40
 
38
41
  rescue Exception => e
39
- puts "Protocol Buffers not installed properly. Switching to JSON.
40
- #{e}"
42
+ logger.warn("Protocol Buffers not installed properly. Switching to JSON.
43
+ #{e}")
41
44
  JsonSignalFx.new(api_token,
42
45
  enable_aws_unique_id: enable_aws_unique_id,
43
46
  ingest_endpoint: ingest_endpoint,
47
+ stream_endpoint: stream_endpoint,
44
48
  timeout: timeout,
45
49
  batch_size: batch_size,
46
50
  user_agents: user_agents)
@@ -31,19 +31,19 @@ class SignalFxClient
31
31
  def initialize(api_token,
32
32
  enable_aws_unique_id: false,
33
33
  ingest_endpoint: RbConfig::DEFAULT_INGEST_ENDPOINT,
34
- api_endpoint: RbConfig::DEFAULT_API_ENDPOINT,
35
34
  stream_endpoint: RbConfig::DEFAULT_STREAM_ENDPOINT,
36
35
  timeout: RbConfig::DEFAULT_TIMEOUT,
37
36
  batch_size: RbConfig::DEFAULT_BATCH_SIZE,
38
- user_agents: [])
37
+ user_agents: [],
38
+ logger: Logger.new(STDOUT, progname: "signalfx"))
39
39
 
40
40
  @api_token = api_token
41
41
  @ingest_endpoint = ingest_endpoint
42
- @api_endpoint = api_endpoint
43
42
  @stream_endpoint = stream_endpoint
44
43
  @timeout = timeout
45
44
  @batch_size = batch_size
46
45
  @user_agents = user_agents
46
+ @logger = logger
47
47
 
48
48
  @aws_unique_id = nil
49
49
 
@@ -55,9 +55,9 @@ class SignalFxClient
55
55
  if request != nil
56
56
  json_resp = JSON.parse(request.body)
57
57
  @aws_unique_id = json_resp['instanceId']+'_'+json_resp['region']+'_'+json_resp['accountId']
58
- puts("AWS Unique ID loaded: #{@aws_unique_id}")
58
+ @logger.info("AWS Unique ID loaded: #{@aws_unique_id}")
59
59
  else
60
- puts('Failed to retrieve AWS unique ID.')
60
+ @logger.warn('Failed to retrieve AWS unique ID.')
61
61
  end
62
62
  }
63
63
  end
@@ -172,7 +172,7 @@ class SignalFxClient
172
172
  # @return [SignalFlowClient] a newly instantiated client, configured with the
173
173
  # api token and endpoints from this class
174
174
  def signalflow
175
- SignalFlowClient.new(@api_token, @api_endpoint, @stream_endpoint)
175
+ SignalFlowClient.new(@api_token, @stream_endpoint)
176
176
  end
177
177
 
178
178
  protected
@@ -223,14 +223,14 @@ class SignalFxClient
223
223
  block.call(response)
224
224
  end
225
225
  else
226
- puts "Failed to send datapoints. Response code: #{response.code}"
226
+ @logger.error("Failed to send datapoints. Response code: #{response.code}")
227
227
  if block
228
228
  block.call(nil)
229
229
  end
230
230
  end
231
231
  }
232
232
  rescue Exception => e
233
- puts "Failed to send datapoints. Error: #{e}"
233
+ @logger.error("Failed to send datapoints. Error: #{e}")
234
234
  if block
235
235
  block.call(nil)
236
236
  end
@@ -246,12 +246,12 @@ class SignalFxClient
246
246
  when 200
247
247
  return block.call(response)
248
248
  else
249
- puts "Failed to retrieve AWS unique ID. Response code: #{response.code}"
249
+ @logger.warn("Failed to retrieve AWS unique ID. Response code: #{response.code}")
250
250
  return block.call(nil)
251
251
  end
252
252
  }
253
253
  rescue Exception => e
254
- puts "Failed to retrieve AWS unique ID. Error: #{e}"
254
+ @logger.warn("Failed to retrieve AWS unique ID. Error: #{e}")
255
255
  block.call(nil)
256
256
  end
257
257
  end
@@ -19,7 +19,7 @@ require_relative "./websocket"
19
19
  # our API reference for SignalFlow}. Hash keys will be symbols instead of
20
20
  # strings.
21
21
  class SignalFlowClient
22
- def initialize(api_token, api_endpoint, stream_endpoint)
22
+ def initialize(api_token, stream_endpoint)
23
23
  @transport = SignalFlowWebsocketTransport.new(api_token, stream_endpoint)
24
24
  end
25
25
 
@@ -17,9 +17,10 @@ class SignalFlowWebsocketTransport
17
17
  # A lower bound on the amount of time to wait for a computation to start
18
18
  COMPUTATION_START_TIMEOUT_SECONDS = 30
19
19
 
20
- def initialize(api_token, stream_endpoint)
20
+ def initialize(api_token, stream_endpoint, logger: Logger.new(STDOUT, progname: "signalfx"))
21
21
  @api_token = api_token
22
22
  @stream_endpoint = stream_endpoint
23
+ @logger = logger
23
24
  @compress = true
24
25
 
25
26
  @lock = Mutex.new
@@ -217,7 +218,7 @@ class SignalFlowWebsocketTransport
217
218
 
218
219
  message_received(m.data, m.type == :text)
219
220
  rescue Exception => e
220
- puts "Error processing SignalFlow message: #{e.backtrace.first}: #{e.message} (#{e.class})"
221
+ @logger.error("Error processing SignalFlow message: #{e.backtrace.first}: #{e.message} (#{e.class})")
221
222
  end
222
223
  end
223
224
 
@@ -237,7 +238,7 @@ class SignalFlowWebsocketTransport
237
238
  {verify_mode: OpenSSL::SSL::VERIFY_PEER}) do |ws|
238
239
  @ws = ws
239
240
  ws.on :error do |e|
240
- puts "ERROR #{e.inspect}"
241
+ @logger.error("ERROR #{e.inspect}")
241
242
  end
242
243
 
243
244
  ws.on :close do |e|
@@ -2,7 +2,7 @@
2
2
 
3
3
  module SignalFx
4
4
  module Version
5
- VERSION = '2.0.5'
5
+ VERSION = '2.1.0'
6
6
  NAME = 'signalfx-ruby-client'
7
7
  end
8
- end
8
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: signalfx
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SignalFx, Inc
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-18 00:00:00.000000000 Z
11
+ date: 2019-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -218,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
218
  version: '0'
219
219
  requirements: []
220
220
  rubyforge_project:
221
- rubygems_version: 2.5.2
221
+ rubygems_version: 2.5.2.3
222
222
  signing_key:
223
223
  specification_version: 4
224
224
  summary: Ruby client library for SignalFx