aws-xray 0.30.1 → 0.31.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9600aaff8b8a437fad42753722c257b732265e80
4
- data.tar.gz: 2a9987c10c0f5cb51b9666054e93c6787ceea6f3
3
+ metadata.gz: ec204a6182574fe431e244db52a75dfdde4ff3d4
4
+ data.tar.gz: 2cc7a2963eceb3eb50a2d36d0f41128df1d8b70c
5
5
  SHA512:
6
- metadata.gz: b0a0a223cd03ba170fd50e844e63907609ead9e2c94026a6804287d3c450ed7c75a800c55f297ee5c03a87b58eccd4eedbcea87fa7561d052b52eae88acf8458
7
- data.tar.gz: 1d5a6721ce34b053febf4f58976c1de1e78d7e3abf9d8654b13166033a7d37e1598093a06a9f4a654aa281d42dcdf14f590503df4dc3cbe741d0fbe505616308
6
+ metadata.gz: e7c5c8e2ad818a848e0adabd9386a1c4a355896d364eacbc5ede702aad07ea4b2e4787eb737a0bc19b7b372f460be24681ba0ee4c805e5347530f402ffcbde51
7
+ data.tar.gz: 4ad68d2b3e93166a27a766749ac90ad6289503462b6ccac2b67c62867de2184d29f3dd8d0b879f79c171aacc5c9d35c5283e3d2f1a69a198c557dd62f07374ab
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
  Only breaking or notable changes.
3
3
 
4
+ ## v0.31.0
5
+ - Rename tracing methods while keeping old methods:
6
+ - `#base_trace` -> `#start_segment`
7
+ - `#child_trace` -> `#start_subsegment`
8
+
4
9
  ## v0.30.0
5
10
  - Drop faraday dependency. Users who want to use Faraday middleware must require `aws/xray/faraday`.
data/README.md CHANGED
@@ -87,7 +87,7 @@ end
87
87
  Aws::Xray.trace(name: 'my-app-batch') do |seg|
88
88
  client.get('/foo')
89
89
 
90
- Aws::Xray::Context.current.child_trace(name: 'fetch-user', remote: true) do |sub|
90
+ Aws::Xray::Context.current.start_subsegment(name: 'fetch-user', remote: true) do |sub|
91
91
  # DB access or something to trace.
92
92
  end
93
93
  end
data/aws-xray.gemspec CHANGED
@@ -32,5 +32,6 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency 'rake'
33
33
  spec.add_development_dependency 'rsolr'
34
34
  spec.add_development_dependency 'rspec'
35
+ spec.add_development_dependency 'simplecov'
35
36
  spec.add_development_dependency 'webmock'
36
37
  end
data/lib/aws/xray.rb CHANGED
@@ -26,7 +26,7 @@ module Aws
26
26
  def self.trace(name: nil)
27
27
  name = name || config.name || raise(MissingNameError)
28
28
  Context.with_new_context(name, Trace.generate) do
29
- Context.current.base_trace do |seg|
29
+ Context.current.start_segment do |seg|
30
30
  yield seg
31
31
  end
32
32
  end
@@ -74,7 +74,7 @@ module Aws
74
74
  #
75
75
  # @yield [Aws::Xray::Segment]
76
76
  # @return [Object] A value which given block returns.
77
- def base_trace
77
+ def start_segment
78
78
  base_segment = Segment.build(@name, @trace)
79
79
  @base_segment_id = base_segment.id
80
80
 
@@ -88,12 +88,13 @@ module Aws
88
88
  Client.send_segment(base_segment) if @trace.sampled?
89
89
  end
90
90
  end
91
+ alias_method :base_trace, :start_segment
91
92
 
92
93
  # @param [Boolean] remote
93
94
  # @param [String] name Arbitrary name of the sub segment. e.g. "funccall_f".
94
95
  # @yield [Aws::Xray::Subsegment]
95
96
  # @return [Object] A value which given block returns.
96
- def child_trace(remote:, name:)
97
+ def start_subsegment(remote:, name:)
97
98
  raise SegmentDidNotStartError unless @base_segment_id
98
99
  sub = Subsegment.build(@trace, @base_segment_id, remote: remote, name: overwrite_name(name))
99
100
 
@@ -107,6 +108,7 @@ module Aws
107
108
  Client.send_segment(sub) if @trace.sampled?
108
109
  end
109
110
  end
111
+ alias_method :child_trace, :start_subsegment
110
112
 
111
113
  # Temporary disabling tracing for given id in given block.
112
114
  # CAUTION: the disabling will NOT be propagated between threads!!
@@ -17,7 +17,7 @@ module Aws
17
17
 
18
18
  name = @name || req_env.request_headers['Host'] || "unknown-request-from-#{Context.current.name}"
19
19
 
20
- Context.current.child_trace(remote: true, name: name) do |sub|
20
+ Context.current.start_subsegment(remote: true, name: name) do |sub|
21
21
  propagate_trace = sub.generate_trace
22
22
  req_env.request_headers[TRACE_HEADER] = propagate_trace.to_header_value
23
23
  sub.set_http_request(Request.build_from_faraday_env(req_env))
@@ -22,7 +22,7 @@ module Aws
22
22
  user_agent: req['User-Agent'],
23
23
  )
24
24
  name = req[NAME_HEADER] || req['Host'] || address
25
- Context.current.child_trace(remote: true, name: name) do |sub|
25
+ Context.current.start_subsegment(remote: true, name: name) do |sub|
26
26
  propagate_trace = sub.generate_trace
27
27
  req[TRACE_HEADER] = propagate_trace.to_header_value
28
28
  sub.set_http_request(request_record)
data/lib/aws/xray/rack.rb CHANGED
@@ -27,7 +27,7 @@ module Aws
27
27
  env[TRACE_ENV] = trace.to_header_value
28
28
 
29
29
  Context.with_new_context(@name, trace) do
30
- Context.current.base_trace do |seg|
30
+ Context.current.start_segment do |seg|
31
31
  seg.set_http_request(Request.build_from_rack_env(env))
32
32
  status, headers, body = @app.call(env)
33
33
  length = headers['Content-Length'] || 0
@@ -1,5 +1,5 @@
1
1
  module Aws
2
2
  module Xray
3
- VERSION = '0.30.1'
3
+ VERSION = '0.31.0'
4
4
  end
5
5
  end
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.30.1
4
+ version: 0.31.0
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-26 00:00:00.000000000 Z
11
+ date: 2017-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: simplecov
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: webmock
169
183
  requirement: !ruby/object:Gem::Requirement
@@ -252,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
266
  version: '0'
253
267
  requirements: []
254
268
  rubyforge_project:
255
- rubygems_version: 2.5.2
269
+ rubygems_version: 2.6.11
256
270
  signing_key:
257
271
  specification_version: 4
258
272
  summary: The unofficial X-Ray Tracing SDK for Ruby.