aws-xray 0.17.1 → 0.17.2

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: b9227b7e977572ae1321361acc8260612a19b21d
4
- data.tar.gz: 779b197ccdfb1befca633e7875a223281aa2b16a
3
+ metadata.gz: 3deda3f256b5d2af42eb41c05b185a251778d92b
4
+ data.tar.gz: faa78fd4d89cb7395d1c522ce9ed783aef81a1b8
5
5
  SHA512:
6
- metadata.gz: d3845def551c656b5522a2a03d87cad327003af06919ef847cb356c7c284ccd3880601e7d8f6f11bdd1c3b8d1cd335f952d9b849b3677bf7f696da93e9c88e58
7
- data.tar.gz: 16a6da0c06316fb37f94256094ebe9cadf1b13e67926aaea6890057e3c34510454caae83f0aa1ef89096912729b7fd868480dd9030686d1c7b1599785b987b81
6
+ metadata.gz: 17165b0eca79f5cdd7ad3bf905190a0890b9b8e43373e8a000bb98fec27c83624d38bfa7c2f046f28f5f92742f47de11d808db508f370d14c36c1c92a787d459
7
+ data.tar.gz: bf10745ef15b498e5f4f0e771c6b67304445586867224ef4ce151561b1eef5e1fb46baaf16863db666e1822670282ac61bf9a4eff537e754612517893124f901
data/lib/aws/xray.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'aws/xray/version'
2
+ require 'aws/xray/errors'
2
3
  require 'aws/xray/rack'
3
4
  require 'aws/xray/faraday'
4
5
  require 'aws/xray/configuration'
@@ -8,12 +9,6 @@ module Aws
8
9
  module Xray
9
10
  TRACE_HEADER = 'X-Amzn-Trace-Id'.freeze
10
11
 
11
- class MissingNameError < ::StandardError
12
- def initialize
13
- super("`name` is empty. Configure this with `Aws::Xray.config.name = 'my-app'`.")
14
- end
15
- end
16
-
17
12
  @config = Configuration.new
18
13
  class << self
19
14
  attr_reader :config
@@ -22,9 +22,10 @@ module Aws
22
22
  sock = @sock || UDPSocket.new
23
23
 
24
24
  begin
25
- len = sock.send(payload, 0, @host, @port)
26
- $stderr.puts("Can not send all bytes: #{len} sent") if payload.size != len
27
- rescue SystemCallError, SocketError => e
25
+ len = sock.send(payload, Socket::MSG_DONTWAIT, @host, @port)
26
+ raise CanNotSendAllByteError.new(payload.size, len) if payload.size != len
27
+ len
28
+ rescue SystemCallError, SocketError, CanNotSendAllByteError => e
28
29
  begin
29
30
  Aws::Xray.config.segment_sending_error_handler.call(e, payload, host: @host, port: @port)
30
31
  rescue Exception => e
@@ -6,20 +6,6 @@ module Aws
6
6
  class Context
7
7
  VAR_NAME = :_aws_xray_context_
8
8
 
9
- class BaseError < ::StandardError; end
10
-
11
- class NotSetError < BaseError
12
- def initialize
13
- super('Context is not set for this thread')
14
- end
15
- end
16
-
17
- class SegmentDidNotStartError < BaseError
18
- def initialize
19
- super('Segment did not start yet')
20
- end
21
- end
22
-
23
9
  class << self
24
10
  # @return [Aws::Xray::Context]
25
11
  def current
@@ -0,0 +1,30 @@
1
+ module Aws
2
+ module Xray
3
+ # Bacause we already had another `Error` class for domain object.
4
+ class BaseError < ::StandardError; end
5
+
6
+ class NotSetError < BaseError
7
+ def initialize
8
+ super('Context is not set for this thread')
9
+ end
10
+ end
11
+
12
+ class SegmentDidNotStartError < BaseError
13
+ def initialize
14
+ super('Segment did not start yet')
15
+ end
16
+ end
17
+
18
+ class MissingNameError < BaseError
19
+ def initialize
20
+ super("`name` is empty. Configure this with `Aws::Xray.config.name = 'my-app'`.")
21
+ end
22
+ end
23
+
24
+ class CanNotSendAllByteError < BaseError
25
+ def initialize(payload_len, sent_len)
26
+ super("Can not send all bytes: expected #{payload_len} but #{sent_len} sent")
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,5 +1,5 @@
1
1
  module Aws
2
2
  module Xray
3
- VERSION = '0.17.1'
3
+ VERSION = '0.17.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-xray
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.1
4
+ version: 0.17.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taiki Ono
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-14 00:00:00.000000000 Z
11
+ date: 2017-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -171,6 +171,7 @@ files:
171
171
  - lib/aws/xray/context.rb
172
172
  - lib/aws/xray/error.rb
173
173
  - lib/aws/xray/error_handlers.rb
174
+ - lib/aws/xray/errors.rb
174
175
  - lib/aws/xray/faraday.rb
175
176
  - lib/aws/xray/header_parser.rb
176
177
  - lib/aws/xray/hooks/all.rb