aws-xray-sdk 0.9.0 → 0.10.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
  SHA256:
3
- metadata.gz: 78007efa0d29f0f16fa12ee0437cb6214a64c7d43d6cd1bde7ca9286d44d110b
4
- data.tar.gz: e9fe587611d3f346b98e632ab88772769246d351b06ce46cc42f015fb15899e2
3
+ metadata.gz: 8e7a6c26d4cd8e8669849e6b298d9b07727f4126641e6c4fa3856745f895af08
4
+ data.tar.gz: d0c45a96450d4fab1ad858f0e99f5ab6bf24dd4990750e552df52a6ac4d3d655
5
5
  SHA512:
6
- metadata.gz: bb2ed43b514b1b50278c370c32b159f8f58bed0cd3e105b91f9ff0afb74a6ba66f184f515a294c2520cca7ad9b102506534f58fd4f3a778daeec02688900b437
7
- data.tar.gz: 5ce0c0474f40d316dfa1ec0eddc13d156886c93b211bebd7963ae795c7b1eeca72fbc696d3a0bb948d3ad8ad106eab60d1b0774602217a794c2f92f42bac2938
6
+ metadata.gz: d0fbd0d535f48af1039cc4a256d280721623cf64de498537d074d7ec44ded18d33bd4f1154cebff344ef562a811dfbab683668a9c3bd93036b4d243cd5df2851
7
+ data.tar.gz: b2ef531abf13ac1e72bf0339dd45a55d90a8458018ab5b8993175b2a7c936d0a2fc1cff11abb7373034ee0f55b8b53f2c0a96a1bc523327447ec77994e5e6131
@@ -18,6 +18,10 @@ module XRay
18
18
 
19
19
  def call(context)
20
20
  recorder = Aws.config[:xray_recorder]
21
+ if recorder.current_entity.nil?
22
+ super
23
+ end
24
+
21
25
  operation = context.operation_name
22
26
  service_name = context.client.class.api.metadata['serviceAbbreviation'] ||
23
27
  context.client.class.to_s.split('::')[1]
@@ -20,6 +20,8 @@ module XRay
20
20
  db_config = pool.spec.config
21
21
  name, sql = build_name_sql_meta config: db_config, conn: conn
22
22
  subsegment = XRay.recorder.begin_subsegment name, namespace: 'remote'
23
+ # subsegment is nil in case of context missing
24
+ return if subsegment.nil?
23
25
  subsegment.start_time = transaction.time.to_f
24
26
  subsegment.sql = sql
25
27
  XRay.recorder.end_subsegment end_time: transaction.end.to_f
@@ -57,7 +57,8 @@ module XRay
57
57
  # Begin a new subsegment and add it to be the child of the current active
58
58
  # subsegment or segment. Also tie the new created subsegment to the current context.
59
59
  # Its sampling decision will follow its parent.
60
- # @return [Subsegment] the newly created subsegment.
60
+ # @return [Subsegment] the newly created subsegment. It could be `nil` if no active entity
61
+ # can be found and `context_missing` is set to `LOG_ERROR`.
61
62
  def begin_subsegment(name, namespace: nil, segment: nil)
62
63
  entity = segment || current_entity
63
64
  return unless entity
@@ -104,8 +105,16 @@ module XRay
104
105
  end
105
106
 
106
107
  # Record the passed block as a subsegment.
108
+ # If `context_missing` is set to `LOG_ERROR` and no active entity can be found,
109
+ # the passed block will be executed as normal but it will not be recorded.
107
110
  def capture(name, namespace: nil, segment: nil)
108
111
  subsegment = begin_subsegment name, namespace: namespace, segment: segment
112
+ # prevent passed block from failing in case of context missing with log error
113
+ if subsegment.nil?
114
+ segment = DummySegment.new name: name
115
+ subsegment = DummySubsegment.new name: name, segment: segment
116
+ end
117
+
109
118
  begin
110
119
  yield subsegment
111
120
  rescue Exception => e
@@ -1,3 +1,3 @@
1
1
  module XRay
2
- VERSION = '0.9.0'
2
+ VERSION = '0.10.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-xray-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-09 00:00:00.000000000 Z
11
+ date: 2018-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj
@@ -209,7 +209,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
209
209
  requirements:
210
210
  - - ">="
211
211
  - !ruby/object:Gem::Version
212
- version: '0'
212
+ version: 2.3.6
213
213
  required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  requirements:
215
215
  - - ">="