aws-xray 0.7.2 → 0.8.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
  SHA1:
3
- metadata.gz: 362df5eec453be15bad6af5cc1a2a05af277df70
4
- data.tar.gz: 2280694a354290e4234ba9bbe5928e0f4408e548
3
+ metadata.gz: b0822b0de7d76c5d15689f32c232f7254709e49d
4
+ data.tar.gz: 9c160d3b42b5cf1728ec57249efb665a912a6d8a
5
5
  SHA512:
6
- metadata.gz: e3a379f1e26dbb83a339c2bba8cf4831933bbd13a0884c80a49a709d1606317d0f69755fc9dad5a191bfe6bb01e5f4cb51b243b57242ba254d26fc797525f015
7
- data.tar.gz: e8d77430640aafae31301975d193f1cf22853856376cb3999efe44d3844c9fbc96a4ca3abe73756f35d30bcd3c488705752a7c63907f22e9c60468bc325b9e5e
6
+ metadata.gz: 246afdb37279ae40709afa661964e78767c2b07f867c0239f62b33aa581c4367930158cb66c29c859efb2fcb7c8d19903119ec591822c7736cb7331b3a1d2858
7
+ data.tar.gz: 3e48fd8540c793da5e9f00a0895ab7f283f7e98129509593c974c007e0fcf47860f4e6fec1ee5edfc1eac99a5e84a1cf39cf37b2294eb5946c6d1fa73aeff1b2
data/README.md CHANGED
@@ -98,6 +98,9 @@ end
98
98
 
99
99
  ## Configurations
100
100
  ### X-Ray agent location
101
+ aws-xray does not send any trace data default. Set `AWS_XRAY_LOCATION` environment variable like `AWS_XRAY_LOCATION=localhost:2000`
102
+ or set proper aws-agent location with configuration interface like `Aws::Xray.config.client_options = { host: "localhost", port: 2000 }`.
103
+
101
104
  In container environments, we often run xray agent container beside application container.
102
105
  For that case, pass `AWS_XRAY_LOCATION` environment variable to container to specify host and port of xray agent.
103
106
 
@@ -2,7 +2,7 @@ require 'aws/xray/version'
2
2
  require 'aws/xray/rack'
3
3
  require 'aws/xray/faraday'
4
4
  require 'aws/xray/configuration'
5
- require 'aws/xray/test_socket'
5
+ require 'aws/xray/sockets'
6
6
 
7
7
  module Aws
8
8
  module Xray
@@ -6,8 +6,8 @@ module Aws
6
6
  # thread-unsafe, suppose to be used only in initialization phase.
7
7
  class Configuration
8
8
  option = ENV['AWS_XRAY_LOCATION']
9
- DEFAULT_HOST = option ? option.split(':').first : 'localhost'
10
- DEFAULT_PORT = option ? Integer(option.split(':').last) : 2000
9
+ DEFAULT_HOST = option ? option.split(':').first : nil
10
+ DEFAULT_PORT = option ? Integer(option.split(':').last) : nil
11
11
 
12
12
  name_option = ENV['AWS_XRAY_NAME']
13
13
  DEFAULT_NAME = name_option ? name_option : nil
@@ -24,9 +24,13 @@ module Aws
24
24
  # @return [Hash] client_options For xray-agent client.
25
25
  # - host: e.g. '127.0.0.1'
26
26
  # - port: e.g. 2000
27
- # - sock: test purpose.
28
27
  def client_options
29
- @client_options ||= { host: DEFAULT_HOST, port: DEFAULT_PORT }
28
+ @client_options ||=
29
+ if DEFAULT_HOST && DEFAULT_PORT
30
+ { host: DEFAULT_HOST, port: DEFAULT_PORT }
31
+ else
32
+ { sock: NullSocket.new }
33
+ end
30
34
  end
31
35
  attr_writer :client_options
32
36
 
@@ -13,6 +13,28 @@ module Aws
13
13
  def send(body, *)
14
14
  write(body)
15
15
  end
16
+
17
+ def close; end
18
+ end
19
+
20
+ class IoSocket
21
+ def initialize(io)
22
+ @io = io
23
+ end
24
+
25
+ def send(body, *)
26
+ @io.write(body)
27
+ end
28
+
29
+ def close; end
30
+ end
31
+
32
+ class NullSocket
33
+ def send(body, *)
34
+ body.size
35
+ end
36
+
37
+ def close; end
16
38
  end
17
39
  end
18
40
  end
@@ -1,5 +1,5 @@
1
1
  module Aws
2
2
  module Xray
3
- VERSION = '0.7.2'
3
+ VERSION = '0.8.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-xray
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taiki Ono
@@ -135,8 +135,8 @@ files:
135
135
  - lib/aws/xray/request.rb
136
136
  - lib/aws/xray/response.rb
137
137
  - lib/aws/xray/segment.rb
138
+ - lib/aws/xray/sockets.rb
138
139
  - lib/aws/xray/sub_segment.rb
139
- - lib/aws/xray/test_socket.rb
140
140
  - lib/aws/xray/trace.rb
141
141
  - lib/aws/xray/version.rb
142
142
  - lib/aws/xray/version_detector.rb