aws-xray-sdk 0.11.1 → 0.11.2

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
- SHA256:
3
- metadata.gz: 3ef8621b715e92340eb2dfe27f470fd8e4c92d45d0b21f20d814d3a0b298d323
4
- data.tar.gz: dc4471eebd695a0e4c7fd31cd7b84709ba166a395f6c31785a482272c0a162b6
2
+ SHA1:
3
+ metadata.gz: 12bf7fe4479fe58271466a730e04d20a38d125aa
4
+ data.tar.gz: bd3f3df33fd65ea9f82aa5579316dd8d526d75e2
5
5
  SHA512:
6
- metadata.gz: 656c7425f811713ea11d7e4fb8515d597513c8412f1f77b6a2445c0695b7ff91772815efc349695c49688cb3a1ee07408c4e863811ad40dcde58e8585942dff5
7
- data.tar.gz: fbab0222d5abc0048c0fd32a443b1974ad72072386779e858ef88aa541b2bc2797f44ac9ae3a1ae21c066e44973fa30f0c5d78c7e2523a1d32f26d8b1c417f6f
6
+ metadata.gz: f515f1e1016a02f04ad8fee38848fd95ed432dad394befc512781cd66d7c26b6bd0191c0a7895f1bc98cd5c864722fe01ed93b536d56557e167c94a81233ff80
7
+ data.tar.gz: 9527449a4c4aaccb8496bc6ff5d764609a287d986144538f3821576c44989bee3b8982387f1d9afab8d0663c09618c2f0e202c2abbb0343563c918fb2beba690
@@ -42,7 +42,7 @@ module XRay
42
42
  # setting daemon address for components communicate with X-Ray daemon.
43
43
  def daemon_address=(v)
44
44
  v = ENV[DaemonConfig::DAEMON_ADDRESS_KEY] || v
45
- config = DaemonConfig.new(v)
45
+ config = DaemonConfig.new(addr: v)
46
46
  emitter.daemon_config = config
47
47
  sampler.daemon_config = config if sampler.respond_to?(:daemon_config=)
48
48
  end
@@ -12,7 +12,7 @@ module XRay
12
12
 
13
13
  LOCAL_KEY = '_aws_xray_entity'.freeze
14
14
  CONTEXT_MISSING_KEY = 'AWS_XRAY_CONTEXT_MISSING'.freeze
15
- SUPPORTED_STRATEGY = %w[RUNTIME_ERROR LOG_ERROR].freeze
15
+ SUPPORTED_STRATEGY = %w[RUNTIME_ERROR LOG_ERROR IGNORE_ERROR].freeze
16
16
  DEFAULT_STRATEGY = SUPPORTED_STRATEGY[0]
17
17
 
18
18
  attr_reader :context_missing
@@ -42,12 +42,7 @@ module XRay
42
42
 
43
43
  # Prepares a X-Ray header string based on the provided Segment/Subsegment.
44
44
  def prep_header_str(entity:)
45
- return '' if entity.nil?
46
- root = entity.segment.trace_id
47
- parent_id = entity.id
48
- sampled = entity.sampled ? 1 : 0
49
- header = TraceHeader.new root: root, parent_id: parent_id, sampled: sampled
50
- header.header_string
45
+ TraceHeader.from_entity(entity: entity).header_string
51
46
  end
52
47
  end
53
48
  end
@@ -49,6 +49,8 @@ module XRay
49
49
  resp_meta[:content_length] = len
50
50
  end
51
51
  segment.merge_http_response response: resp_meta
52
+ trace_header = {TRACE_HEADER => TraceHeader.from_entity(entity: segment).root_string}
53
+ headers.merge!(trace_header)
52
54
  [status, headers, body]
53
55
  rescue Exception => e
54
56
  segment.apply_status_code status: 500
@@ -329,6 +329,15 @@ module XRay
329
329
  ]
330
330
  }
331
331
  }
332
+ },
333
+ SNS: {
334
+ operations: {
335
+ publish: {
336
+ request_parameters: %I[
337
+ topic_arn
338
+ ]
339
+ }
340
+ }
332
341
  }
333
342
  }
334
343
  }
@@ -57,7 +57,7 @@ module XRay
57
57
  ElasticLoadBalancingV2
58
58
  ElasticTranscoder
59
59
  ElasticsearchService
60
- Firehost
60
+ Firehose
61
61
  GameLift
62
62
  Glacier
63
63
  Glue
@@ -143,7 +143,9 @@ module XRay
143
143
  else
144
144
  h[:in_progress] = true
145
145
  end
146
- h[:subsegments] = subsegments unless subsegments.empty?
146
+
147
+ h[:subsegments] = subsegments.map(&:to_h) unless subsegments.empty?
148
+
147
149
  h[:aws] = aws if aws
148
150
  if http_request || http_response
149
151
  h[:http] = {}
@@ -17,7 +17,11 @@ module XRay
17
17
  end
18
18
 
19
19
  def to_h
20
- @data
20
+ @data.keys.each_with_object({}) do |key, h|
21
+ h[key] = @data[key].to_h
22
+ h
23
+ end
24
+
21
25
  end
22
26
  end
23
27
 
@@ -18,6 +18,14 @@ module XRay
18
18
  @sampled = sampled.to_i if sampled
19
19
  end
20
20
 
21
+ def self.from_entity(entity:)
22
+ return empty_header if entity.nil?
23
+ root = entity.segment.trace_id
24
+ parent_id = entity.id
25
+ sampled = entity.sampled ? 1 : 0
26
+ new root: root, parent_id: parent_id, sampled: sampled
27
+ end
28
+
21
29
  def self.from_header_string(header_str:)
22
30
  empty_header if header_str.to_s.empty?
23
31
  header = header_str.delete(' ').downcase
@@ -35,15 +43,20 @@ module XRay
35
43
  end
36
44
  end
37
45
 
46
+ # @return [String] The header string of the root object
47
+ def root_string
48
+ %(Root=#{root})
49
+ end
50
+
38
51
  # @return [String] The heading string constructed based on this header object.
39
52
  def header_string
40
53
  return '' unless root
41
54
  if !parent_id
42
- %(Root=#{root};Sampled=#{sampled})
55
+ %(#{root_string};Sampled=#{sampled})
43
56
  elsif !sampled
44
- %(Root=#{root};Parent=#{parent_id})
57
+ %(#{root_string};Parent=#{parent_id})
45
58
  else
46
- %(Root=#{root};Parent=#{parent_id};Sampled=#{sampled})
59
+ %(#{root_string};Parent=#{parent_id};Sampled=#{sampled})
47
60
  end
48
61
  end
49
62
 
@@ -58,7 +58,7 @@ module XRay
58
58
  return sample if sampling_req.nil? || sampling_req.empty?
59
59
  @custom_rules ||= []
60
60
  @custom_rules.each do |c|
61
- return should_sample?(c) if c.applies?(sampling_req: sampling_req)
61
+ return should_sample?(c) if c.applies?(sampling_req)
62
62
  end
63
63
  # use previously made decision based on default rule
64
64
  # if no path-based rule has been matched
@@ -1,3 +1,3 @@
1
1
  module XRay
2
- VERSION = '0.11.1'
2
+ VERSION = '0.11.2'
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.11.1
4
+ version: 0.11.2
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-10-11 00:00:00.000000000 Z
11
+ date: 2019-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-xray
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.0'
75
+ version: '2.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.0'
82
+ version: '2.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: minitest
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -240,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
240
240
  version: '0'
241
241
  requirements: []
242
242
  rubyforge_project:
243
- rubygems_version: 2.7.6
243
+ rubygems_version: 2.6.14
244
244
  signing_key:
245
245
  specification_version: 4
246
246
  summary: AWS X-Ray SDK for Ruby