aws-xray 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -14
- data/bin/console +4 -8
- data/bin/setup +0 -2
- data/lib/aws/xray/rack.rb +3 -0
- data/lib/aws/xray/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1f4338978e5b5f21c1c98380b076d3e4a22e7d6
|
4
|
+
data.tar.gz: 510b3414f6eca43c15be7c8d4f606251afb8e950
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2c7f88c0eed8afbea49ff32739b3e58720c297c929635f3bc517792a3283146b13f94f4dcbd8b046057bcc6b7318b1c5c8be9d4b5d95a3a7ec91ba27c2285b3
|
7
|
+
data.tar.gz: dc3ab34565c1eb7847357c428b0f9e56ac7ed8d44a2895e86d395a51244082fe8c050fdc5d5aa56c073cbef53585060ab12ed6797acf27e453de303f80e2afc9
|
data/README.md
CHANGED
@@ -29,15 +29,7 @@ And then execute:
|
|
29
29
|
|
30
30
|
## Usage
|
31
31
|
### Rails app
|
32
|
-
|
33
|
-
|
34
|
-
```
|
35
|
-
# config/initializers/aws_xray.rb
|
36
|
-
Aws::Xray.config.name = 'my-app'
|
37
|
-
Rails.application.config.middleware.use Aws::Xray::Rack
|
38
|
-
```
|
39
|
-
|
40
|
-
Or just require `aws/xray/rails`. It uses your application name by default.
|
32
|
+
Just require `aws/xray/rails`. It uses your application name by default.
|
41
33
|
e.g. `Legacy::MyBlog` -> `legacy-my-blog`.
|
42
34
|
|
43
35
|
```ruby
|
@@ -90,7 +82,7 @@ end
|
|
90
82
|
Aws::Xray.trace(name: 'my-app-batch') do |seg|
|
91
83
|
client.get('/foo')
|
92
84
|
|
93
|
-
Aws::Xray::Context.current.child_trace do |sub|
|
85
|
+
Aws::Xray::Context.current.child_trace(name: 'fetch-user', remote: true) do |sub|
|
94
86
|
# DB access or something to trace.
|
95
87
|
end
|
96
88
|
end
|
@@ -98,13 +90,13 @@ end
|
|
98
90
|
|
99
91
|
## Configurations
|
100
92
|
### X-Ray agent location
|
101
|
-
aws-xray does not send any trace data
|
93
|
+
aws-xray does not send any trace data dby efault. Set `AWS_XRAY_LOCATION` environment variable like `AWS_XRAY_LOCATION=localhost:2000`
|
102
94
|
or set proper aws-agent location with configuration interface like `Aws::Xray.config.client_options = { host: "localhost", port: 2000 }`.
|
103
95
|
|
104
96
|
In container environments, we often run xray agent container beside application container.
|
105
97
|
For that case, pass `AWS_XRAY_LOCATION` environment variable to container to specify host and port of xray agent.
|
106
98
|
|
107
|
-
```
|
99
|
+
```bash
|
108
100
|
docker run --link xray:xray --env AWS_XRAY_LOCATION=xray:2000 my-application
|
109
101
|
```
|
110
102
|
|
@@ -134,13 +126,13 @@ Aws::Xray.config.default_annotation = Aws::Xray.config.default_annotation.merge(
|
|
134
126
|
|
135
127
|
Keys must be alphanumeric characters with underscore and values must be one of String or Integer or Boolean values.
|
136
128
|
|
137
|
-
For
|
129
|
+
For metadata:
|
138
130
|
|
139
131
|
```ruby
|
140
132
|
Aws::Xray.config.default_metadata = Aws::Xray.config.default_metadata.merge(key: ['some', 'meaningful', 'value'])
|
141
133
|
```
|
142
134
|
|
143
|
-
Note: See official document
|
135
|
+
Note: See official document about annotation and metadata in AWS X-Ray.
|
144
136
|
|
145
137
|
## Development
|
146
138
|
|
data/bin/console
CHANGED
@@ -1,14 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'aws/xray'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
9
|
+
require 'pry'
|
10
|
+
Pry.start
|
data/bin/setup
CHANGED
data/lib/aws/xray/rack.rb
CHANGED
@@ -7,6 +7,7 @@ module Aws
|
|
7
7
|
module Xray
|
8
8
|
class Rack
|
9
9
|
TRACE_ENV = 'HTTP_X_AMZN_TRACE_ID'.freeze
|
10
|
+
ORIGINAL_TRACE_ENV = 'HTTP_X_AMZN_TRACE_ID_ORIGINAL'.freeze
|
10
11
|
|
11
12
|
# @param [Hash] client_options For xray-agent client.
|
12
13
|
# - host: e.g. '127.0.0.1'
|
@@ -37,6 +38,8 @@ module Aws
|
|
37
38
|
else
|
38
39
|
Trace.generate
|
39
40
|
end
|
41
|
+
env[ORIGINAL_TRACE_ENV] = env[TRACE_ENV] # just for the record
|
42
|
+
env[TRACE_ENV] = trace.to_header_value
|
40
43
|
|
41
44
|
Context.with_new_context(@name, @client, trace) do
|
42
45
|
Context.current.base_trace do |seg|
|
data/lib/aws/xray/version.rb
CHANGED