aws-xray 0.30.0 → 0.30.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws/xray/trace.rb +14 -6
- 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: 9600aaff8b8a437fad42753722c257b732265e80
|
4
|
+
data.tar.gz: 2a9987c10c0f5cb51b9666054e93c6787ceea6f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0a0a223cd03ba170fd50e844e63907609ead9e2c94026a6804287d3c450ed7c75a800c55f297ee5c03a87b58eccd4eedbcea87fa7561d052b52eae88acf8458
|
7
|
+
data.tar.gz: 1d5a6721ce34b053febf4f58976c1de1e78d7e3abf9d8654b13166033a7d37e1598093a06a9f4a654aa281d42dcdf14f590503df4dc3cbe741d0fbe505616308
|
data/lib/aws/xray/trace.rb
CHANGED
@@ -13,7 +13,8 @@ module Aws
|
|
13
13
|
def build_from_header_value(header_value, now = Time.now)
|
14
14
|
h = HeaderParser.parse(header_value)
|
15
15
|
root = h['Root'] || generate_root(now)
|
16
|
-
|
16
|
+
rest = h.dup.tap {|e| %w[Root Sampled Parent].each {|k| e.delete(k) } }
|
17
|
+
new(root: root, sampled: decide_sampling(h['Sampled']), parent: h['Parent'], rest: rest)
|
17
18
|
end
|
18
19
|
|
19
20
|
private
|
@@ -41,17 +42,15 @@ module Aws
|
|
41
42
|
|
42
43
|
attr_reader :root, :parent
|
43
44
|
|
44
|
-
def initialize(root:, sampled:, parent: nil)
|
45
|
+
def initialize(root:, sampled:, parent: nil, rest: {})
|
45
46
|
@root = root
|
46
47
|
@sampled = sampled
|
47
48
|
@parent = parent
|
49
|
+
@rest = rest
|
48
50
|
end
|
49
51
|
|
50
52
|
def to_header_value
|
51
|
-
v
|
52
|
-
sampled? ? v << 'Sampled=1' : v << 'Sampled=0'
|
53
|
-
v << ";Parent=#{@parent}" if has_parent?
|
54
|
-
v
|
53
|
+
to_header_hash.map {|k, v| "#{k}=#{v}" }.join(';')
|
55
54
|
end
|
56
55
|
|
57
56
|
def sampled?
|
@@ -65,6 +64,15 @@ module Aws
|
|
65
64
|
def copy(parent: @parent)
|
66
65
|
self.class.new(root: @root.dup, sampled: @sampled, parent: parent ? parent.dup : nil)
|
67
66
|
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def to_header_hash
|
71
|
+
h = {'Root' => @root, 'Sampled' => sampled? ? '1' : '0' }
|
72
|
+
h['Parent'] = @parent if has_parent?
|
73
|
+
h.merge!(@rest)
|
74
|
+
h
|
75
|
+
end
|
68
76
|
end
|
69
77
|
end
|
70
78
|
end
|
data/lib/aws/xray/version.rb
CHANGED