Sha256: 970f30f69e4576577784753b5e995fc9017a30f9456dd09380f0efaace9d0db8

Contents?: true

Size: 547 Bytes

Versions: 2

Compression:

Stored size: 547 Bytes

Contents

# 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)
		unless self.transient?
			trace_context = Traces.trace_context
		end
		
		super do
			Traces.trace_context = trace_context
			
			if annotation = self.annotation
				attributes = {
					"annotation" => annotation
				}
			end
			
			Traces.trace("async.task", attributes: attributes) do
				yield
			end
		end
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
async-2.21.0 lib/traces/provider/async/task.rb
async-2.20.0 lib/traces/provider/async/task.rb