aws-xray 0.17.1 → 0.17.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws/xray.rb +1 -6
- data/lib/aws/xray/client.rb +4 -3
- data/lib/aws/xray/context.rb +0 -14
- data/lib/aws/xray/errors.rb +30 -0
- data/lib/aws/xray/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3deda3f256b5d2af42eb41c05b185a251778d92b
|
4
|
+
data.tar.gz: faa78fd4d89cb7395d1c522ce9ed783aef81a1b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/aws/xray/client.rb
CHANGED
@@ -22,9 +22,10 @@ module Aws
|
|
22
22
|
sock = @sock || UDPSocket.new
|
23
23
|
|
24
24
|
begin
|
25
|
-
len = sock.send(payload,
|
26
|
-
|
27
|
-
|
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
|
data/lib/aws/xray/context.rb
CHANGED
@@ -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
|
data/lib/aws/xray/version.rb
CHANGED
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.
|
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-
|
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
|