Sha256: 8bbe16019c47a164f574836eee7eff92e44df9ea426da9850629fe7d3fa844cb

Contents?: true

Size: 874 Bytes

Versions: 9

Compression:

Stored size: 874 Bytes

Contents

require 'sqreen/ecosystem/module_registry'
require 'sqreen/ecosystem/transaction_storage'
require 'sqreen/ecosystem/module_api/signal_producer'

module Sqreen
  module Ecosystem
    class TracingIdSetup
      # @param [Array<Sqreen::Ecosystem::ModuleApi::SignalProducer>] signal_producer_modules
      def initialize(signal_producer_modules)
        @modules = signal_producer_modules
        @tracing_id_prefix = nil
      end

      def setup_modules
        inject_out_of_tx_tracing_id_gen
      end

      attr_writer :tracing_id_prefix

      private

      def inject_out_of_tx_tracing_id_gen
        @modules.each do |mod|
          mod.tracing_id_producer = method(:generate_tracing_id)
        end
      end

      def generate_tracing_id
        return nil unless @tracing_id_prefix
        "#{@tracing_id_prefix}.#{SecureRandom.uuid}"
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sqreen-1.22.0-java lib/sqreen/ecosystem/tracing_id_setup.rb
sqreen-1.22.0 lib/sqreen/ecosystem/tracing_id_setup.rb
sqreen-1.21.1-java lib/sqreen/ecosystem/tracing_id_setup.rb
sqreen-1.21.1 lib/sqreen/ecosystem/tracing_id_setup.rb
sqreen-1.21.0-java lib/sqreen/ecosystem/tracing_id_setup.rb
sqreen-1.21.0 lib/sqreen/ecosystem/tracing_id_setup.rb
sqreen-1.21.0.beta3-java lib/sqreen/ecosystem/tracing_id_setup.rb
sqreen-1.21.0.beta3 lib/sqreen/ecosystem/tracing_id_setup.rb
sqreen-1.21.0.beta2 lib/sqreen/ecosystem/tracing_id_setup.rb