request-tracer 0.5.6 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/request_tracer/trace.rb +2 -2
- data/lib/request_tracer/version.rb +1 -1
- data/spec/lib/request_tracer/trace_spec.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODhiNWZjMmY0OWNiNTk2YTMyYjIyMjMwMWI2NzVmN2M0MmIxZWM0ZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDgyOGNiZjM3NjYxNGEzMmMyN2U0NTI4ZTA0N2M2ZTBmMTc0ODlhYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZGVhYTBiM2MzNzJkMjc3MTVhOTc0MDQxZDc0ZmY4ODg3ODUyMmMyNzU5ZTYx
|
10
|
+
MGRmNGQ5OTU4ODI1MTNjODY1OWY0MDJjOGY4NGEwYTNmOTgwODhhMWE3NjNj
|
11
|
+
YWMxMTIwNzNlNjJiNWYzYjI2MWEzNTE2NTI2Njc0ZWUxYjE0OTE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmU2YTc0NTFkMzE4MzczMWRlNmVjNDc5MWRhYmI0OWRlNDM5ZDRkMzBmMjVm
|
14
|
+
NWY3MDk4MzVkMmJmMDQ5ZmJmY2MxNzM0MzY0MGJiMGU5MjY2ZDY3NGNiNTcx
|
15
|
+
NjAxOTIxNTRhYTI4NTRjYWQzZjZlMDI2NTIyNDY2OTJjYzFjNTk=
|
data/lib/request_tracer/trace.rb
CHANGED
@@ -39,7 +39,7 @@ module RequestTracer
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def ==(other_span)
|
42
|
-
other_span
|
42
|
+
other_span && (other_span.value == @value)
|
43
43
|
end
|
44
44
|
def to_s; "%016x" % @value; end
|
45
45
|
def to_i; @i64; end
|
@@ -129,7 +129,7 @@ module RequestTracer
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def record(annotation = nil, &block)
|
132
|
-
tracer.record(latest
|
132
|
+
tracer.record((latest && latest.next_id) || create, annotation, &block)
|
133
133
|
end
|
134
134
|
|
135
135
|
def tracer=(tracer)
|
@@ -4,7 +4,7 @@ describe RequestTracer::Trace do
|
|
4
4
|
let(:trace_stack_size) { rand(2) }
|
5
5
|
let(:trace_stack) do
|
6
6
|
(1..trace_stack_size).inject([]) do |stack, i|
|
7
|
-
stack + [stack.last
|
7
|
+
stack + [(stack.last && stack.last.next_id) || described_class.create]
|
8
8
|
end
|
9
9
|
end
|
10
10
|
before do
|
@@ -17,7 +17,7 @@ describe RequestTracer::Trace do
|
|
17
17
|
end
|
18
18
|
it 'generates a new span_id for the scope of the block' do
|
19
19
|
temp_span = record do |t|
|
20
|
-
expect(t.span_id).not_to eq(trace_stack.last
|
20
|
+
expect(t.span_id).not_to eq(trace_stack.last && trace_stack.last.span_id)
|
21
21
|
expect(described_class.latest).to eq(t)
|
22
22
|
t
|
23
23
|
end
|
@@ -25,10 +25,10 @@ describe RequestTracer::Trace do
|
|
25
25
|
end
|
26
26
|
it 'takes the old span_id as the parent_span_id' do
|
27
27
|
temp_span = record do |t|
|
28
|
-
expect(t.parent_id).to eq(trace_stack.last
|
28
|
+
expect(t.parent_id).to eq(trace_stack.last && trace_stack.last.span_id)
|
29
29
|
t
|
30
30
|
end
|
31
|
-
expect(described_class.latest
|
31
|
+
expect(described_class.latest && described_class.latest.span_id).to eq(temp_span.parent_id)
|
32
32
|
end
|
33
33
|
context 'when no previous trace exists' do
|
34
34
|
let(:trace_stack_size) { 0 }
|