File tree 3 files changed +10
-4
lines changed
lib/traces/provider/async 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -27,5 +27,7 @@ Gem::Specification.new do |spec|
27
27
28
28
spec . add_dependency "console" , "~> 1.29"
29
29
spec . add_dependency "fiber-annotation"
30
- spec . add_dependency "io-event" , [ "~> 1.6" , ">= 1.6.5" ]
30
+ spec . add_dependency "io-event" , "~> 1.7"
31
+ spec . add_dependency "traces" , "~> 0.15"
32
+ spec . add_dependency "metrics" , "~> 0.12"
31
33
end
Original file line number Diff line number Diff line change 25
25
gem "decode"
26
26
gem "rubocop"
27
27
28
- gem "traces"
29
- gem "metrics"
30
-
31
28
gem "sus-fixtures-async"
32
29
gem "sus-fixtures-console"
33
30
gem "sus-fixtures-time"
Original file line number Diff line number Diff line change 8
8
9
9
Traces ::Provider ( Async ::Task ) do
10
10
def schedule ( &block )
11
+ # If we are not actively tracing anything, then we can skip this:
12
+ unless Traces . active?
13
+ return super ( &block )
14
+ end
15
+
11
16
unless self . transient?
12
17
trace_context = Traces . trace_context
13
18
end
@@ -18,6 +23,7 @@ def schedule(&block)
18
23
"transient" => self . transient? ,
19
24
}
20
25
26
+ # Run the trace in the context of the child task:
21
27
super do
22
28
Traces . trace_context = trace_context
23
29
@@ -26,6 +32,7 @@ def schedule(&block)
26
32
end
27
33
28
34
Traces . trace ( "async.task" , attributes : attributes ) do
35
+ # Yes, this is correct, we already called super above:
29
36
yield
30
37
end
31
38
end
You can’t perform that action at this time.
0 commit comments