Sha256: 15308be75a86743a40c9f114dcb99be0be9570933aa6e2ed8a913c0a8132d1d4

Contents?: true

Size: 515 Bytes

Versions: 1

Compression:

Stored size: 515 Bytes

Contents

# frozen_string_literal: true

require 'ddtrace'

# https://github.com/DataDog/dd-trace-rb/blob/master/docs/UpgradeGuide.md#between-threads
class Thread
  def self.new_traced
    trace = Datadog::Tracing.active_trace
    trace_digest = trace.to_digest

    Thread.new do |*args|
       # Inherits trace properties from the trace digest
      Datadog::Tracing.trace(trace.name, continue_from: trace_digest) do |_span, trace|
        trace.id == trace_digest.trace_id
        yield(*args)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
instrument_all_the_things-2.0.1 lib/instrument_all_the_things/thread.rb