Files
news.gitea.happylizard.me/bin/gems/async-2.23.0/lib/traces/provider/async/task.rb
T
pizza2d1 4cee170d66
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 9s
Add bin and edit workflow
2026-09-16 13:11:16 -06:00

41 lines
929 B
Ruby

# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022, by Samuel Williams.
require_relative "../../../async/task"
require "traces/provider"
Traces::Provider(Async::Task) do
def schedule(&block)
# If we are not actively tracing anything, then we can skip this:
unless Traces.active?
return super(&block)
end
unless self.transient?
trace_context = Traces.trace_context
end
attributes = {
# We use the instance variable as it corresponds to the user-provided block.
"block" => @block,
"transient" => self.transient?,
}
# Run the trace in the context of the child task:
super do
Traces.trace_context = trace_context
if annotation = self.annotation
attributes["annotation"] = annotation
end
Traces.trace("async.task", attributes: attributes) do
# Yes, this is correct, we already called super above:
yield
end
end
end
end