Sha256: 07e99988fbebcd079b41d27008273a0a34a5eee8c7052e453bd36df575d15eda

Contents?: true

Size: 1.93 KB

Versions: 11

Compression:

Stored size: 1.93 KB

Contents

# frozen_string_literal: true

# == Schema Information
#
# Table name: rmp_profiled_requests
#
#  id                   :integer          not null, primary key
#  user_id              :string
#  start                :bigint
#  finish               :bigint
#  duration             :integer
#  allocations          :bigint
#  request_path         :string
#  request_query_string :string
#  request_method       :string
#  request_headers      :json
#  request_body         :text
#  response_status      :integer
#  response_body        :text
#  response_headers     :json
#  response_media_type  :string
#  created_at           :datetime         not null
#  updated_at           :datetime         not null
#
# Indexes
#
#  index_rmp_profiled_requests_on_created_at  (created_at)
#
module RailsMiniProfiler
  class ProfiledRequest < RailsMiniProfiler::ApplicationRecord
    self.table_name = RailsMiniProfiler.storage_configuration.profiled_requests_table

    has_one :flamegraph,
            class_name: 'RailsMiniProfiler::Flamegraph',
            foreign_key: :rmp_profiled_request_id,
            dependent: :destroy

    has_many :traces,
             class_name: 'RailsMiniProfiler::Trace',
             foreign_key: :rmp_profiled_request_id,
             dependent: :destroy

    def request=(request)
      self.request_body = request.body
      self.request_headers = request.headers
      self.request_method = request.method
      self.request_path = request.path
      self.request_query_string = request.query_string
    end

    def response=(response)
      self.response_body = response.body
      self.response_media_type = response.media_type
      self.response_headers = response.headers
      self.response_status = response.status
    end

    def total_time=(total_time)
      self.start = total_time.start
      self.finish = total_time.finish
      self.duration = total_time.duration
      self.allocations = total_time.allocations
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rails_mini_profiler-0.7.0 app/models/rails_mini_profiler/profiled_request.rb
rails_mini_profiler-0.6.0 app/models/rails_mini_profiler/profiled_request.rb
rails_mini_profiler-0.5.0 app/models/rails_mini_profiler/profiled_request.rb
rails_mini_profiler-0 app/models/rails_mini_profiler/profiled_request.rb
rails_mini_profiler-0.4.0 app/models/rails_mini_profiler/profiled_request.rb
rails_mini_profiler-0.3.0 app/models/rails_mini_profiler/profiled_request.rb
rails_mini_profiler-0.2.1 app/models/rails_mini_profiler/profiled_request.rb
rails_mini_profiler-0.2.0 app/models/rails_mini_profiler/profiled_request.rb
rails_mini_profiler-0.1.3 app/models/rails_mini_profiler/profiled_request.rb
rails_mini_profiler-0.1.2 app/models/rails_mini_profiler/profiled_request.rb
rails_mini_profiler-0.1.1 app/models/rails_mini_profiler/profiled_request.rb