Skip to content

Commit 1363629

Browse files
committed
Better support for OpenTelemetry.
- Prefer to use `Traces.current_context` and `Traces.with_context`.
1 parent 185cd48 commit 1363629

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

async.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ Gem::Specification.new do |spec|
2929
spec.add_dependency "fiber-annotation"
3030
spec.add_dependency "io-event", "~> 1.11"
3131
spec.add_dependency "metrics", "~> 0.12"
32-
spec.add_dependency "traces", "~> 0.15"
32+
spec.add_dependency "traces", "~> 0.18"
3333
end

lib/traces/provider/async/task.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def schedule(&block)
1414
end
1515

1616
unless self.transient?
17-
trace_context = Traces.trace_context
17+
trace_context = Traces.current_context
1818
end
1919

2020
attributes = {
@@ -25,7 +25,7 @@ def schedule(&block)
2525

2626
# Run the trace in the context of the child task:
2727
super do
28-
Traces.trace_context = trace_context
28+
Traces.with_context(trace_context)
2929

3030
if annotation = self.annotation
3131
attributes["annotation"] = annotation

0 commit comments

Comments
 (0)