Sha256: 8c5d3b92a8f6c980356d41c5eb2855f17232d843752241c31bb756ba3c6c1591

Contents?: true

Size: 853 Bytes

Versions: 5

Compression:

Stored size: 853 Bytes

Contents

module RailsPerformance
  class CurrentRequest
    attr_reader :request_id, :tracings, :ignore
    attr_accessor :data
    attr_accessor :record

    def self.init
      Thread.current[:rp_current_request] ||= CurrentRequest.new(SecureRandom.hex(16))
    end

    def self.current
      CurrentRequest.init
    end

    def self.cleanup
      RailsPerformance.log "----------------------------------------------------> CurrentRequest.cleanup !!!!!!!!!!!! -------------------------\n\n"
      RailsPerformance.skip = false
      Thread.current[:rp_current_request] = nil
    end

    def initialize(request_id)
      @request_id = request_id
      @tracings = []
      @ignore = Set.new
      @data = nil
      @record = nil
    end

    def trace(options = {})
      @tracings << options.merge(time: RailsPerformance::Utils.time.to_i)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_performance-1.4.1 lib/rails_performance/thread/current_request.rb
rails_performance-1.4.1.alpha1 lib/rails_performance/thread/current_request.rb
rails_performance-1.4.0 lib/rails_performance/thread/current_request.rb
rails_performance-1.4.0.alpha5 lib/rails_performance/thread/current_request.rb
rails_performance-1.4.0.alpha4 lib/rails_performance/thread/current_request.rb