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 +4 -4
- data/README.md +3 -0
- data/lib/aws/xray.rb +1 -1
- data/lib/aws/xray/configuration.rb +8 -4
- data/lib/aws/xray/{test_socket.rb → sockets.rb} +22 -0
- data/lib/aws/xray/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0822b0de7d76c5d15689f32c232f7254709e49d
|
4
|
+
data.tar.gz: 9c160d3b42b5cf1728ec57249efb665a912a6d8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/aws/xray.rb
CHANGED
@@ -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 :
|
10
|
-
DEFAULT_PORT = option ? Integer(option.split(':').last) :
|
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 ||=
|
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
|
data/lib/aws/xray/version.rb
CHANGED
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.
|
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
|