aws-xray 0.34.0 → 0.34.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +7 -0
- data/README.md +133 -131
- data/aws-xray.gemspec +1 -0
- data/lib/aws/xray.rb +40 -13
- data/lib/aws/xray/context.rb +6 -11
- data/lib/aws/xray/error_handlers.rb +1 -5
- data/lib/aws/xray/hooks/net_http.rb +2 -1
- data/lib/aws/xray/version.rb +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6211707f740b26f01a68faba9498a0d7424eff34
|
4
|
+
data.tar.gz: 8d52e3d25f2f259c6afab89ee63ea89bbdae8b58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cff14025420e63287722a2066b72dbdf6858b6583d87643e4e833f4b4b0f32dedbb139937ae12bdd6534c667870e0e9ba02fc95a2e6a4993602211252d509718
|
7
|
+
data.tar.gz: 79230a1f4630fea2344a03391bd0cc5f55bfb5fb73b9cc5ae0088cb42fa5f18ee7b3ebe94138a4f6fbf9d89a7d5951f343fc451ae9833b979c17cbfa2ab79a73
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
## Contributing
|
2
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/taiki45/aws-xray.
|
3
|
+
|
4
|
+
## Development
|
5
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment. `rake` runs automated tests.
|
6
|
+
|
7
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
data/README.md
CHANGED
@@ -2,153 +2,68 @@
|
|
2
2
|
[![Build Status](https://travis-ci.org/taiki45/aws-xray.svg?branch=master)](https://travis-ci.org/taiki45/aws-xray)
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/aws-xray.svg)](https://badge.fury.io/rb/aws-xray)
|
4
4
|
[![Coverage Status](https://coveralls.io/repos/github/taiki45/aws-xray/badge.svg)](https://coveralls.io/github/taiki45/aws-xray)
|
5
|
+
[![Inline docs](http://inch-ci.org/github/taiki45/aws-xray.svg?branch=master)](http://inch-ci.org/github/taiki45/aws-xray)
|
5
6
|
|
6
7
|
The unofficial AWS X-Ray Tracing SDK for Ruby.
|
7
|
-
It enables you to capture in-coming HTTP requests and out-going HTTP requests and send them to
|
8
|
+
It enables you to capture in-coming HTTP requests and out-going HTTP requests and send them to X-Ray daemon automatically.
|
8
9
|
|
9
|
-
AWS X-Ray is a
|
10
|
+
AWS X-Ray is a distributed tracing system. See more detail about AWS X-Ray at [official document](http://docs.aws.amazon.com/xray/latest/devguide/aws-xray.html).
|
11
|
+
If you want to know what is distributed tracing, what is problems behind, etc.., please refer [Google's Dapper paper](https://research.google.com/pubs/pub36356.html).
|
10
12
|
|
11
13
|
## Features
|
14
|
+
aws-xray has full feautres to build and send tracing data to AWS X-Ray.
|
15
|
+
|
12
16
|
- Propagatin support in both single and multi thread environment.
|
13
|
-
-
|
14
|
-
-
|
15
|
-
- net/http hook.
|
16
|
-
- Tracing HTTP request/response.
|
17
|
-
- Tracing errors.
|
17
|
+
- Instrumentation for major libraries.
|
18
|
+
- Recording HTTP request/response and errors.
|
18
19
|
- Annotation and metadata support.
|
19
|
-
- Sampling
|
20
|
-
|
21
|
-
## Installation
|
22
|
-
|
23
|
-
Add this line to your application's Gemfile:
|
24
|
-
|
25
|
-
```ruby
|
26
|
-
gem 'aws-xray'
|
27
|
-
```
|
20
|
+
- Sampling.
|
28
21
|
|
29
|
-
|
22
|
+
## Supported libraries
|
23
|
+
- net/http
|
24
|
+
- rack
|
25
|
+
- faraday
|
26
|
+
- activerecord
|
27
|
+
- rsolr
|
30
28
|
|
31
|
-
|
32
|
-
|
33
|
-
## Usage
|
29
|
+
## Getting started
|
34
30
|
### Rails app
|
35
|
-
Just require `aws/xray/rails`. It uses your application name by default.
|
36
|
-
e.g. `Legacy::MyBlog` -> `legacy-my-blog`.
|
31
|
+
Just require `aws/xray/rails`. It uses your application name by default. e.g. `Legacy::MyBlog` -> `legacy-my-blog`.
|
37
32
|
|
38
33
|
```ruby
|
39
34
|
# Gemfile
|
40
|
-
gem 'aws-xray', require: 'aws/xray/rails'
|
35
|
+
gem 'aws-xray', require: ['aws/xray/rails', 'aws/xray/hooks/net_http']
|
41
36
|
```
|
42
37
|
|
43
|
-
|
38
|
+
Requiring `aws/xray/rails` inserts Rack middleware to the middleware stack and the middleware automatically starts tracing context. Another requiring `aws/xray/hooks/net_http` inserts a hook to net/http and it records out-going HTTP requests/responses automatically.
|
44
39
|
|
45
|
-
|
46
|
-
|
47
|
-
# config.ru
|
48
|
-
require 'aws-xray'
|
49
|
-
Aws::Xray.config.name = 'my-app'
|
50
|
-
use Aws::Xray::Rack
|
51
|
-
```
|
40
|
+
Then setup [X-Ray daemon](http://docs.aws.amazon.com/xray/latest/devguide/xray-daemon.html) in your runtime environment.
|
41
|
+
Once the daemon is ready, run your application with some environment variable required by aws-xray gem.
|
52
42
|
|
53
|
-
|
43
|
+
- `AWS_XRAY_LOCATION`: Point to X-Ray daemon's bind address and port. e.g. `localhost:2000`.
|
44
|
+
- `AWS_XRAY_SAMPLING_RATE`: Set sampling rate. If you are just checking behavior, you can disable sampling by setting `1`.
|
45
|
+
- `AWS_XRAY_EXCLUDED_PATHS`: Set your application's health check paths to avoid tracing health check requests.
|
54
46
|
|
55
|
-
|
47
|
+
You then see your application builds and sends tracing data to X-Ray daemon.
|
56
48
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
builder.use Aws::Xray::Faraday
|
61
|
-
# ...
|
62
|
-
end
|
63
|
-
```
|
64
|
-
|
65
|
-
If you don't use any Service Discovery tools, pass the down stream app name to the Faraday middleware:
|
66
|
-
|
67
|
-
```ruby
|
68
|
-
require 'aws/xray/faraday'
|
69
|
-
Faraday.new('...') do |builder|
|
70
|
-
builder.use Aws::Xray::Faraday, 'down-stream-app-id'
|
71
|
-
# ...
|
72
|
-
end
|
73
|
-
```
|
74
|
-
|
75
|
-
### non-Rack app (like background jobs)
|
76
|
-
```ruby
|
77
|
-
require 'aws-xray'
|
78
|
-
|
79
|
-
# Build HTTP client with Faraday builder.
|
80
|
-
# You can set the down stream app id to Host header as well.
|
81
|
-
client = Faraday.new('...') do |builder|
|
82
|
-
builder.use Aws::Xray::Faraday, 'down-stream-app-id'
|
83
|
-
# ...
|
84
|
-
end
|
85
|
-
|
86
|
-
# Start new tracing context then perform arbitrary actions in the block.
|
87
|
-
Aws::Xray.trace(name: 'my-app-batch') do |seg|
|
88
|
-
client.get('/foo')
|
89
|
-
|
90
|
-
Aws::Xray.start_subsegment(name: 'fetch-user', remote: true) do |sub|
|
91
|
-
# DB access or something to trace.
|
92
|
-
end
|
93
|
-
end
|
94
|
-
```
|
95
|
-
|
96
|
-
### Hooks
|
97
|
-
You can enable all the hooks with:
|
98
|
-
|
99
|
-
```ruby
|
100
|
-
# Gemfile
|
101
|
-
gem 'aws-xray', require: 'aws/xray/hooks/all'
|
102
|
-
```
|
103
|
-
|
104
|
-
#### net/http hook
|
105
|
-
To monkey patch net/http and records out-going http requests automatically, just require `aws/xray/hooks/net_http`:
|
106
|
-
|
107
|
-
If you can pass headers for net/http client, you can setup subsegment name via `X-Aws-Xray-Name` header:
|
108
|
-
|
109
|
-
```ruby
|
110
|
-
Net::HTTP.start(host, port) do |http|
|
111
|
-
req = Net::HTTP::Get.new(uri, { 'X-Aws-Xray-Name' => 'target-app' })
|
112
|
-
http.request(req)
|
113
|
-
end
|
114
|
-
```
|
115
|
-
|
116
|
-
If you can't access headers, e.g. external client library like aws-sdk or dogapi-rb, setup subsegment name by `Aws::Xray.overwrite`:
|
117
|
-
|
118
|
-
```ruby
|
119
|
-
client = Aws::Sns::Client.new
|
120
|
-
response = Aws::Xray.overwrite(name: 'sns') do
|
121
|
-
client.create_topic(...)
|
122
|
-
end
|
123
|
-
```
|
124
|
-
|
125
|
-
#### rsolr hook
|
126
|
-
When you want to name solr requests, use this hook by require `aws/xray/hooks/rsolr`. The typical usecase is you use local haproxy to proxy to solr instances and you want to distinguish these requests from other reqeusts using local haproxy.
|
127
|
-
|
128
|
-
If you want to give a specific name, configure it:
|
129
|
-
|
130
|
-
```ruby
|
131
|
-
Aws::Xray.config.solr_hook_name = 'solr-development'
|
132
|
-
```
|
49
|
+
## Configurations
|
50
|
+
### Summary
|
51
|
+
Recommend setting these operatinal concern via environment variables.
|
133
52
|
|
134
|
-
|
135
|
-
|
53
|
+
Name | Env var | Ruby interface
|
54
|
+
-- | -- | --
|
55
|
+
X-Ray daemon location | `AWS_XRAY_LOCATION` | `config.client_options`
|
56
|
+
Sampling rate | `AWS_XRAY_SAMPLING_RATE` | `config.sampling_rate`
|
57
|
+
Excluded paths | `AWS_XRAY_EXCLUDED_PATHS` | `config.excluded_paths`
|
58
|
+
Application name | `AWS_XRAY_NAME` | `config.name`
|
136
59
|
|
137
|
-
|
138
|
-
Thread.new(Aws::Xray.current_context.copy) do |context|
|
139
|
-
Aws::Xray.with_given_context(context) do
|
140
|
-
# Do something
|
141
|
-
end
|
142
|
-
end
|
143
|
-
```
|
60
|
+
See more configuration at [API documentation](http://www.rubydoc.info/gems/aws-xray/Aws/Xray/Configuration).
|
144
61
|
|
145
|
-
|
146
|
-
|
147
|
-
aws-xray does not send any trace data by default. Set `AWS_XRAY_LOCATION` environment variable like `AWS_XRAY_LOCATION=localhost:2000`
|
148
|
-
or set proper aws-agent location with configuration interface like `Aws::Xray.config.client_options = { host: "localhost", port: 2000 }`.
|
62
|
+
### X-Ray daemon location
|
63
|
+
aws-xray does not send any trace data by default. Set `AWS_XRAY_LOCATION` environment variable like `AWS_XRAY_LOCATION=localhost:2000`.
|
149
64
|
|
150
|
-
In container environments, we
|
151
|
-
For that case, pass `AWS_XRAY_LOCATION` environment variable to container to specify host and port of
|
65
|
+
In container environments, we run X-Ray daemon container beside application container.
|
66
|
+
For that case, pass `AWS_XRAY_LOCATION` environment variable to container to specify host and port of X-Ray daemon.
|
152
67
|
|
153
68
|
```bash
|
154
69
|
docker run --link xray:xray --env AWS_XRAY_LOCATION=xray:2000 my-application
|
@@ -215,16 +130,103 @@ Aws::Xray.config.segment_sending_error_handler = Aws::Xray::ErrorHandlerWithSent
|
|
215
130
|
Set `Aws::Xray.config.record_caller_of_http_requests = true` if you want investigate the caller of specific HTTP requests.
|
216
131
|
It records caller of net/http and Faraday middleware.
|
217
132
|
|
218
|
-
##
|
133
|
+
## Usage
|
134
|
+
### Multi threaded environment
|
135
|
+
Tracing context is thread local. To pass current tracing context, copy current tracing context:
|
219
136
|
|
220
|
-
|
137
|
+
```ruby
|
138
|
+
Thread.new(Aws::Xray.current_context.copy) do |context|
|
139
|
+
Aws::Xray.with_given_context(context) do
|
140
|
+
# Do something
|
141
|
+
end
|
142
|
+
end
|
143
|
+
```
|
221
144
|
|
222
|
-
|
145
|
+
### Background jobs or offline processing
|
146
|
+
```ruby
|
147
|
+
require 'aws/xray'
|
148
|
+
require 'aws/xray/hooks/net_http'
|
223
149
|
|
224
|
-
|
150
|
+
# Start new tracing context then perform arbitrary actions in the block.
|
151
|
+
Aws::Xray.trace(name: 'my-app-batch') do |seg|
|
152
|
+
# Record out-going HTTP request/response with net/http hook.
|
153
|
+
Net::HTTP.get('example.com', '/index.html')
|
225
154
|
|
226
|
-
|
155
|
+
# Record arbitrary actions as subsegment.
|
156
|
+
Aws::Xray.start_subsegment(name: 'fetch-user', remote: true) do |sub|
|
157
|
+
# DB access or something to trace.
|
158
|
+
end
|
159
|
+
end
|
160
|
+
```
|
161
|
+
|
162
|
+
### Rack middleware
|
163
|
+
```ruby
|
164
|
+
# config.ru
|
165
|
+
require 'aws-xray'
|
166
|
+
Aws::Xray.config.name = 'my-app'
|
167
|
+
use Aws::Xray::Rack
|
168
|
+
```
|
169
|
+
|
170
|
+
This enables your app to start tracing context.
|
171
|
+
|
172
|
+
### Faraday middleware
|
173
|
+
```ruby
|
174
|
+
require 'aws/xray/faraday'
|
175
|
+
Faraday.new('...', headers: { 'Host' => 'down-stream-app-id' } ) do |builder|
|
176
|
+
builder.use Aws::Xray::Faraday
|
177
|
+
# ...
|
178
|
+
end
|
179
|
+
```
|
227
180
|
|
228
|
-
|
181
|
+
If you don't use any Service Discovery tools, pass the down stream app name to the Faraday middleware:
|
229
182
|
|
230
|
-
|
183
|
+
```ruby
|
184
|
+
require 'aws/xray/faraday'
|
185
|
+
Faraday.new('...') do |builder|
|
186
|
+
builder.use Aws::Xray::Faraday, 'down-stream-app-id'
|
187
|
+
# ...
|
188
|
+
end
|
189
|
+
```
|
190
|
+
|
191
|
+
### Hooks
|
192
|
+
You can enable all the hooks with:
|
193
|
+
|
194
|
+
```ruby
|
195
|
+
# Gemfile
|
196
|
+
gem 'aws-xray', require: 'aws/xray/hooks/all'
|
197
|
+
```
|
198
|
+
|
199
|
+
#### net/http hook
|
200
|
+
To monkey patch net/http and records out-going http requests automatically, just require `aws/xray/hooks/net_http`:
|
201
|
+
|
202
|
+
If you can pass headers for net/http client, you can setup subsegment name via `X-Aws-Xray-Name` header:
|
203
|
+
|
204
|
+
```ruby
|
205
|
+
Net::HTTP.start(host, port) do |http|
|
206
|
+
req = Net::HTTP::Get.new(uri, { 'X-Aws-Xray-Name' => 'target-app' })
|
207
|
+
http.request(req)
|
208
|
+
end
|
209
|
+
```
|
210
|
+
|
211
|
+
If you can't access headers, e.g. external client library like aws-sdk or dogapi-rb, setup subsegment name by `Aws::Xray.overwrite`:
|
212
|
+
|
213
|
+
```ruby
|
214
|
+
client = Aws::Sns::Client.new
|
215
|
+
response = Aws::Xray.overwrite(name: 'sns') do
|
216
|
+
client.create_topic(...)
|
217
|
+
end
|
218
|
+
```
|
219
|
+
|
220
|
+
#### activerecord hook
|
221
|
+
`require 'aws/xray/hooks/active_record'`.
|
222
|
+
|
223
|
+
Note this hook can record large amount of data.
|
224
|
+
|
225
|
+
#### rsolr hook
|
226
|
+
When you want to name solr requests, use this hook by require `aws/xray/hooks/rsolr`. The typical usecase is you use local haproxy to proxy to solr instances and you want to distinguish these requests from other reqeusts using local haproxy.
|
227
|
+
|
228
|
+
If you want to give a specific name, configure it:
|
229
|
+
|
230
|
+
```ruby
|
231
|
+
Aws::Xray.config.solr_hook_name = 'solr-development'
|
232
|
+
```
|
data/aws-xray.gemspec
CHANGED
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency 'rake'
|
34
34
|
spec.add_development_dependency 'rsolr'
|
35
35
|
spec.add_development_dependency 'rspec'
|
36
|
+
spec.add_development_dependency 'sentry-raven'
|
36
37
|
spec.add_development_dependency 'simplecov'
|
37
38
|
spec.add_development_dependency 'sqlite3'
|
38
39
|
spec.add_development_dependency 'webmock'
|
data/lib/aws/xray.rb
CHANGED
@@ -23,6 +23,11 @@ module Aws
|
|
23
23
|
Worker.reset(Worker::Configuration.new)
|
24
24
|
|
25
25
|
class << self
|
26
|
+
# Start new tracing context and segment. If `trace` is given it start tracing context
|
27
|
+
# following given `trace`. If `name` is omitted, it uses global
|
28
|
+
# application name. Rescue all exceptions and record the exception to the
|
29
|
+
# segment. Then re-raise the exception.
|
30
|
+
#
|
26
31
|
# @param [String] name a logical name of this tracing context.
|
27
32
|
# @return [Object] result of given block
|
28
33
|
def trace(name: nil, trace: Trace.generate)
|
@@ -34,11 +39,28 @@ module Aws
|
|
34
39
|
end
|
35
40
|
end
|
36
41
|
|
37
|
-
#
|
42
|
+
# Start subsegment if current thread has tracing context then send the
|
43
|
+
# subsegment to X-Ray daemon. Rescue all exceptions and record the
|
44
|
+
# exception to the subsegment. Then re-raise the exception.
|
45
|
+
#
|
46
|
+
# @yield [Aws::Xray::Subsegment] null subsegment
|
47
|
+
# @return [Object] result of given block
|
48
|
+
def start_subsegment(name:, remote:, &block)
|
49
|
+
if started?
|
50
|
+
current_context.start_subsegment(name: name, remote: remote, &block)
|
51
|
+
else
|
52
|
+
block.call(Subsegment.build_null)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Returns whether tracing context is started or not.
|
57
|
+
# @return [Boolean]
|
38
58
|
def started?
|
39
59
|
Context.started?
|
40
60
|
end
|
41
61
|
|
62
|
+
# Return current tracing context set to current thread.
|
63
|
+
#
|
42
64
|
# @return [Aws::Xray::Context]
|
43
65
|
# @raise [Aws::Xray::NotSetError] when the current context is not yet set.
|
44
66
|
# Call this method after start tracing with `Aws::Xray.trace`.
|
@@ -46,22 +68,17 @@ module Aws
|
|
46
68
|
Context.current
|
47
69
|
end
|
48
70
|
|
71
|
+
# Set tracing context to current thread with given context object.
|
72
|
+
#
|
49
73
|
# @param [Aws::Xray::Context] context copied context
|
50
74
|
# @return [Object] result of given block
|
51
75
|
def with_given_context(context, &block)
|
52
76
|
Context.with_given_context(context, &block)
|
53
77
|
end
|
54
78
|
|
55
|
-
#
|
56
|
-
#
|
57
|
-
|
58
|
-
if started?
|
59
|
-
current_context.start_subsegment(name: name, remote: remote, &block)
|
60
|
-
else
|
61
|
-
block.call(Subsegment.build_null)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
79
|
+
# Temporary disabling tracing for given id in given block.
|
80
|
+
# CAUTION: the disabling will NOT be propagated between threads!!
|
81
|
+
#
|
65
82
|
# @param [Symbol] id
|
66
83
|
# @return [Object] result of given block
|
67
84
|
def disable_trace(id, &block)
|
@@ -72,8 +89,18 @@ module Aws
|
|
72
89
|
end
|
73
90
|
end
|
74
91
|
|
75
|
-
#
|
76
|
-
#
|
92
|
+
# Returns whether tracing is disabled with `.disable_trace` for given `id`.
|
93
|
+
# @param [Symbol] id
|
94
|
+
# @return [Boolean]
|
95
|
+
def disabled?(id)
|
96
|
+
started? && current_context.disabled?(id)
|
97
|
+
end
|
98
|
+
|
99
|
+
# Temporary overwrite subsegment with the name in the block. The
|
100
|
+
# overwriting will be occured only one time. If current context is not
|
101
|
+
# set to current thread, do nothing. CAUTION: the injection will NOT be
|
102
|
+
# propagated between threads!!
|
103
|
+
#
|
77
104
|
# @param [String] name
|
78
105
|
# @return [Object] result of given block
|
79
106
|
def overwrite(name:, &block)
|
data/lib/aws/xray/context.rb
CHANGED
@@ -69,9 +69,7 @@ module Aws
|
|
69
69
|
self.class.new(@name.dup, @trace.copy, @base_segment_id ? @base_segment_id.dup : nil)
|
70
70
|
end
|
71
71
|
|
72
|
-
#
|
73
|
-
# Then re-raise the exception.
|
74
|
-
#
|
72
|
+
# Use `Aws::Xray.trace` instead of this.
|
75
73
|
# @yield [Aws::Xray::Segment]
|
76
74
|
# @return [Object] A value which given block returns.
|
77
75
|
def start_segment
|
@@ -90,6 +88,7 @@ module Aws
|
|
90
88
|
end
|
91
89
|
alias_method :base_trace, :start_segment
|
92
90
|
|
91
|
+
# Use `Aws::Xray.start_subsegment` instead of this.
|
93
92
|
# @param [Boolean] remote
|
94
93
|
# @param [String] name Arbitrary name of the sub segment. e.g. "funccall_f".
|
95
94
|
# @yield [Aws::Xray::Subsegment]
|
@@ -110,9 +109,7 @@ module Aws
|
|
110
109
|
end
|
111
110
|
alias_method :child_trace, :start_subsegment
|
112
111
|
|
113
|
-
#
|
114
|
-
# CAUTION: the disabling will NOT be propagated between threads!!
|
115
|
-
#
|
112
|
+
# Use `Aws::Xray.disable_trace` instead of this.
|
116
113
|
# @param [Symbol] id must be unique between tracing methods.
|
117
114
|
def disable_trace(id)
|
118
115
|
@disabled_ids << id
|
@@ -124,15 +121,13 @@ module Aws
|
|
124
121
|
end
|
125
122
|
end
|
126
123
|
|
124
|
+
# Use `Aws::Xray.disabled?` instead of this.
|
125
|
+
# @param [Symbol] id
|
126
|
+
# @return [Boolean]
|
127
127
|
def disabled?(id)
|
128
128
|
@disabled_ids.include?(id)
|
129
129
|
end
|
130
130
|
|
131
|
-
# CAUTION: the injection will NOT be propagated between threads!!
|
132
|
-
#
|
133
|
-
# Temporary overwrite subsegment with the name in the block. The
|
134
|
-
# overwriting will be occured only one time.
|
135
|
-
#
|
136
131
|
# @param [String] name
|
137
132
|
def overwrite(name:)
|
138
133
|
return yield if @subsegment_name
|
@@ -26,11 +26,7 @@ Error: #{error}
|
|
26
26
|
ERROR_LEVEL = 'warning'.freeze
|
27
27
|
|
28
28
|
def call(error, payload, host:, port:)
|
29
|
-
|
30
|
-
::Raven.capture_exception(error, level: ERROR_LEVEL, extra: { 'payload' => payload })
|
31
|
-
else
|
32
|
-
$stderr.puts('ErrorHandlerWithSentry is configured but `Raven` is undefined.')
|
33
|
-
end
|
29
|
+
::Raven.capture_exception(error, level: ERROR_LEVEL, extra: { 'payload' => payload })
|
34
30
|
end
|
35
31
|
end
|
36
32
|
end
|
@@ -27,7 +27,8 @@ module Aws
|
|
27
27
|
req[TRACE_HEADER] = propagate_trace.to_header_value
|
28
28
|
sub.set_http_request(request_record)
|
29
29
|
|
30
|
-
|
30
|
+
# Don't record twice if down-steam caller calls Net::HTTP#request again.
|
31
|
+
res = Context.current.disable_trace(:net_http) { request_without_aws_xray(req, *args, &block) }
|
31
32
|
|
32
33
|
sub.set_http_response_with_error(res.code.to_i, res['Content-Length'], remote: true)
|
33
34
|
sub.add_metadata(CallerBuilder.call) if Aws::Xray.config.record_caller_of_http_requests
|
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.34.
|
4
|
+
version: 0.34.1
|
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-07-
|
11
|
+
date: 2017-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -178,6 +178,20 @@ dependencies:
|
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: sentry-raven
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: simplecov
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -231,6 +245,7 @@ files:
|
|
231
245
|
- ".rspec"
|
232
246
|
- ".travis.yml"
|
233
247
|
- CHANGELOG.md
|
248
|
+
- CONTRIBUTING.md
|
234
249
|
- Gemfile
|
235
250
|
- LICENSE.txt
|
236
251
|
- README.md
|
@@ -297,7 +312,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
297
312
|
version: '0'
|
298
313
|
requirements: []
|
299
314
|
rubyforge_project:
|
300
|
-
rubygems_version: 2.
|
315
|
+
rubygems_version: 2.6.11
|
301
316
|
signing_key:
|
302
317
|
specification_version: 4
|
303
318
|
summary: The unofficial X-Ray Tracing SDK for Ruby.
|