rails_mini_profiler 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/controllers/rails_mini_profiler/application_controller.rb +0 -9
- data/app/controllers/rails_mini_profiler/profiled_requests_controller.rb +16 -0
- data/app/models/rails_mini_profiler/profiled_request.rb +1 -1
- data/app/models/rails_mini_profiler/trace.rb +0 -15
- data/app/presenters/rails_mini_profiler/controller_trace_presenter.rb +10 -2
- data/app/presenters/rails_mini_profiler/instantiation_trace_presenter.rb +15 -3
- data/app/presenters/rails_mini_profiler/render_partial_trace_presenter.rb +6 -2
- data/app/presenters/rails_mini_profiler/render_template_trace_presenter.rb +6 -2
- data/app/presenters/rails_mini_profiler/sequel_trace_presenter.rb +16 -4
- data/app/presenters/rails_mini_profiler/trace_presenter.rb +1 -1
- data/app/views/rails_mini_profiler/profiled_requests/show/_trace.html.erb +1 -1
- data/lib/generators/rails_mini_profiler/templates/rails_mini_profiler.rb.erb +1 -1
- data/lib/rails_mini_profiler/badge.rb +20 -11
- data/lib/rails_mini_profiler/configuration/user_interface.rb +10 -2
- data/lib/rails_mini_profiler/configuration.rb +4 -0
- data/lib/rails_mini_profiler/middleware.rb +10 -10
- data/lib/rails_mini_profiler/request_context.rb +22 -18
- data/lib/rails_mini_profiler/request_wrapper.rb +12 -55
- data/lib/rails_mini_profiler/response_wrapper.rb +21 -17
- data/lib/rails_mini_profiler/{tracing → tracers}/controller_tracer.rb +15 -1
- data/lib/rails_mini_profiler/tracers/instantiation_tracer.rb +17 -0
- data/lib/rails_mini_profiler/{tracing → tracers}/null_trace.rb +1 -1
- data/lib/rails_mini_profiler/tracers/registry.rb +76 -0
- data/lib/rails_mini_profiler/tracers/rmp_tracer.rb +17 -0
- data/lib/rails_mini_profiler/{tracing → tracers}/sequel_tracer.rb +15 -1
- data/lib/rails_mini_profiler/{tracing → tracers}/sequel_tracker.rb +4 -1
- data/lib/rails_mini_profiler/{tracing → tracers}/subscriptions.rb +6 -12
- data/lib/rails_mini_profiler/{tracing → tracers}/trace.rb +2 -2
- data/lib/rails_mini_profiler/tracers/trace_factory.rb +27 -0
- data/lib/rails_mini_profiler/{tracing → tracers}/tracer.rb +15 -1
- data/lib/rails_mini_profiler/tracers/view_tracer.rb +29 -0
- data/lib/rails_mini_profiler/tracers.rb +14 -0
- data/lib/rails_mini_profiler/version.rb +1 -1
- data/lib/rails_mini_profiler.rb +1 -1
- metadata +15 -18
- data/app/models/rails_mini_profiler/controller_trace.rb +0 -37
- data/app/models/rails_mini_profiler/instantiation_trace.rb +0 -37
- data/app/models/rails_mini_profiler/render_partial_trace.rb +0 -37
- data/app/models/rails_mini_profiler/render_template_trace.rb +0 -37
- data/app/models/rails_mini_profiler/rmp_trace.rb +0 -35
- data/app/models/rails_mini_profiler/sequel_trace.rb +0 -37
- data/lib/rails_mini_profiler/tracing/trace_factory.rb +0 -37
- data/lib/rails_mini_profiler/tracing/view_tracer.rb +0 -12
- data/lib/rails_mini_profiler/tracing.rb +0 -11
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RailsMiniProfiler
|
4
|
+
module Tracers
|
5
|
+
class InstantiationTracer < Tracer
|
6
|
+
class << self
|
7
|
+
def subscribes_to
|
8
|
+
'instantiation.active_record'
|
9
|
+
end
|
10
|
+
|
11
|
+
def presents
|
12
|
+
InstantiationTracePresenter
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RailsMiniProfiler
|
4
|
+
module Tracers
|
5
|
+
# This serves as a central store for tracers. Based on the configuration, indidual tracers are registered and are
|
6
|
+
# then available to subscribe to events or render traced events.
|
7
|
+
#
|
8
|
+
# @api private
|
9
|
+
class Registry
|
10
|
+
class << self
|
11
|
+
def setup!(config)
|
12
|
+
new(config)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(config)
|
17
|
+
@config = config
|
18
|
+
@config.tracers.each { |tracer| add(tracer) }
|
19
|
+
end
|
20
|
+
|
21
|
+
# Tracers that are available in the application, indexed by events they subscribe to.
|
22
|
+
#
|
23
|
+
# @return [Hash] a hash where keys are event names and values are the corresponding tracers
|
24
|
+
def tracers
|
25
|
+
@tracers ||=
|
26
|
+
tracer_map
|
27
|
+
.values
|
28
|
+
.each_with_object({}) do |tracer, obj|
|
29
|
+
subscriptions = wrap(tracer.subscribes_to)
|
30
|
+
subscriptions.each { |subscription| obj[subscription] = tracer }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Presenters that are available in the application, indexed by events they should present.
|
35
|
+
#
|
36
|
+
# @return [Hash] a hash where keys are event names and values are the corresponding presenters
|
37
|
+
def presenters
|
38
|
+
@presenters ||=
|
39
|
+
tracer_map
|
40
|
+
.values
|
41
|
+
.each_with_object({}) do |tracer, obj|
|
42
|
+
presenters = tracer.presents
|
43
|
+
if presenters.is_a?(Hash)
|
44
|
+
obj.merge!(presenters)
|
45
|
+
else
|
46
|
+
obj[tracer.subscribes_to] = presenters
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def tracer_map
|
54
|
+
@tracer_map ||= {}
|
55
|
+
end
|
56
|
+
|
57
|
+
def add(tracer)
|
58
|
+
tracer = tracer.to_sym
|
59
|
+
tracer = "#{tracer.to_s.camelize}Tracer"
|
60
|
+
constant = "RailsMiniProfiler::Tracers::#{tracer}".safe_constantize
|
61
|
+
|
62
|
+
tracer_map[tracer] = constant if constant
|
63
|
+
end
|
64
|
+
|
65
|
+
def wrap(object)
|
66
|
+
if object.nil?
|
67
|
+
[]
|
68
|
+
elsif object.respond_to?(:to_ary)
|
69
|
+
object.to_ary || [object]
|
70
|
+
else
|
71
|
+
[object]
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RailsMiniProfiler
|
4
|
+
module Tracers
|
5
|
+
class RmpTracer < Tracer
|
6
|
+
class << self
|
7
|
+
def subscribes_to
|
8
|
+
'rails_mini_profiler.total_time'
|
9
|
+
end
|
10
|
+
|
11
|
+
def presents
|
12
|
+
RmpTracePresenter
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,8 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module RailsMiniProfiler
|
4
|
-
module
|
4
|
+
module Tracers
|
5
5
|
class SequelTracer < Tracer
|
6
|
+
class << self
|
7
|
+
def subscribes_to
|
8
|
+
'sql.active_record'
|
9
|
+
end
|
10
|
+
|
11
|
+
def build_from(event)
|
12
|
+
new(event).trace
|
13
|
+
end
|
14
|
+
|
15
|
+
def presents
|
16
|
+
SequelTracePresenter
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
6
20
|
def trace
|
7
21
|
return NullTrace.new if ignore?
|
8
22
|
|
@@ -1,7 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module RailsMiniProfiler
|
4
|
-
module
|
4
|
+
module Tracers
|
5
|
+
# Utility to clean up and simplify SQL Notification events.
|
6
|
+
#
|
7
|
+
# @api private
|
5
8
|
class SqlTracker
|
6
9
|
TRACKED_SQL_COMMANDS = %w[SELECT INSERT UPDATE DELETE].freeze
|
7
10
|
UNTRACKED_NAMES = %w[SCHEMA].freeze
|
@@ -1,20 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module RailsMiniProfiler
|
4
|
-
module
|
4
|
+
module Tracers
|
5
|
+
# Subscribe to application events. This is used during engine startup.
|
6
|
+
# @api private
|
5
7
|
class Subscriptions
|
6
|
-
DEFAULT_SUBSCRIPTIONS = %w[
|
7
|
-
sql.active_record
|
8
|
-
instantiation.active_record
|
9
|
-
render_template.action_view
|
10
|
-
render_partial.action_view
|
11
|
-
process_action.action_controller
|
12
|
-
rails_mini_profiler.total_time
|
13
|
-
].freeze
|
14
|
-
|
15
8
|
class << self
|
16
|
-
|
17
|
-
|
9
|
+
# Subscribe to each individual active support event using a callback.
|
10
|
+
def setup!(subscriptions, &callback)
|
11
|
+
subscriptions.each do |event|
|
18
12
|
subscribe(event, &callback)
|
19
13
|
end
|
20
14
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module RailsMiniProfiler
|
4
|
-
module
|
4
|
+
module Tracers
|
5
5
|
# A simplified representation of a trace.
|
6
6
|
#
|
7
7
|
# Is transformed into [RailsMiniProfiler::Trace] when recording has finished.
|
@@ -23,7 +23,7 @@ module RailsMiniProfiler
|
|
23
23
|
# @!attribute backtrace
|
24
24
|
# @return [String] the line where this trace was recorded
|
25
25
|
# @!attribute allocations
|
26
|
-
# @return [Integer] the number of
|
26
|
+
# @return [Integer] the number of allocations
|
27
27
|
# @!attribute created_at
|
28
28
|
# @return [DateTime] the creation date
|
29
29
|
# @!attribute updated_at
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RailsMiniProfiler
|
4
|
+
module Tracers
|
5
|
+
# Creates traces based on the tracers registered with the application
|
6
|
+
#
|
7
|
+
# For example, an event with name 'sequel' will result in the lookup of a tracers that responds to that particular
|
8
|
+
# event. The tracer itself will then build the trace from the event.
|
9
|
+
#
|
10
|
+
# @api private
|
11
|
+
class TraceFactory
|
12
|
+
def initialize(registry)
|
13
|
+
@tracers = registry.tracers
|
14
|
+
end
|
15
|
+
|
16
|
+
# Create a new trace from an event
|
17
|
+
#
|
18
|
+
# @param event [ActiveSupport::Notifications::Event] an event from the application
|
19
|
+
#
|
20
|
+
# @return [Trace] a processed trace
|
21
|
+
def create(event)
|
22
|
+
tracer = @tracers[event.name] || Tracer
|
23
|
+
tracer.build_from(event)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -1,8 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module RailsMiniProfiler
|
4
|
-
module
|
4
|
+
module Tracers
|
5
5
|
class Tracer
|
6
|
+
class << self
|
7
|
+
def subscribes_to
|
8
|
+
[]
|
9
|
+
end
|
10
|
+
|
11
|
+
def presents
|
12
|
+
TracePresenter
|
13
|
+
end
|
14
|
+
|
15
|
+
def build_from(event)
|
16
|
+
new(event).trace
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
6
20
|
def initialize(event)
|
7
21
|
@event = event_data(event)
|
8
22
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RailsMiniProfiler
|
4
|
+
module Tracers
|
5
|
+
class ViewTracer < Tracer
|
6
|
+
class << self
|
7
|
+
def subscribes_to
|
8
|
+
%w[render_template.action_view render_partial.action_view]
|
9
|
+
end
|
10
|
+
|
11
|
+
def build_from(event)
|
12
|
+
new(event).trace
|
13
|
+
end
|
14
|
+
|
15
|
+
def presents
|
16
|
+
{
|
17
|
+
'render_template.action_view' => RenderTemplateTracePresenter,
|
18
|
+
'render_partial.action_view' => RenderPartialTracePresenter
|
19
|
+
}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def trace
|
24
|
+
@event[:payload].slice!(:identifier, :count)
|
25
|
+
super
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails_mini_profiler/tracers/registry'
|
4
|
+
require 'rails_mini_profiler/tracers/subscriptions'
|
5
|
+
require 'rails_mini_profiler/tracers/trace'
|
6
|
+
require 'rails_mini_profiler/tracers/tracer'
|
7
|
+
require 'rails_mini_profiler/tracers/controller_tracer'
|
8
|
+
require 'rails_mini_profiler/tracers/instantiation_tracer'
|
9
|
+
require 'rails_mini_profiler/tracers/sequel_tracker'
|
10
|
+
require 'rails_mini_profiler/tracers/sequel_tracer'
|
11
|
+
require 'rails_mini_profiler/tracers/view_tracer'
|
12
|
+
require 'rails_mini_profiler/tracers/rmp_tracer'
|
13
|
+
require 'rails_mini_profiler/tracers/null_trace'
|
14
|
+
require 'rails_mini_profiler/tracers/trace_factory'
|
data/lib/rails_mini_profiler.rb
CHANGED
@@ -8,7 +8,7 @@ require 'rails_mini_profiler/version'
|
|
8
8
|
require 'rails_mini_profiler/engine'
|
9
9
|
|
10
10
|
require 'rails_mini_profiler/models/base_model'
|
11
|
-
require 'rails_mini_profiler/
|
11
|
+
require 'rails_mini_profiler/tracers'
|
12
12
|
require 'rails_mini_profiler/configuration'
|
13
13
|
|
14
14
|
require 'rails_mini_profiler/user'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_mini_profiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hschne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inline_svg
|
@@ -125,14 +125,8 @@ files:
|
|
125
125
|
- app/javascript/stylesheets/rails-mini-profiler.scss
|
126
126
|
- app/javascript/stylesheets/traces.scss
|
127
127
|
- app/models/rails_mini_profiler/application_record.rb
|
128
|
-
- app/models/rails_mini_profiler/controller_trace.rb
|
129
128
|
- app/models/rails_mini_profiler/flamegraph.rb
|
130
|
-
- app/models/rails_mini_profiler/instantiation_trace.rb
|
131
129
|
- app/models/rails_mini_profiler/profiled_request.rb
|
132
|
-
- app/models/rails_mini_profiler/render_partial_trace.rb
|
133
|
-
- app/models/rails_mini_profiler/render_template_trace.rb
|
134
|
-
- app/models/rails_mini_profiler/rmp_trace.rb
|
135
|
-
- app/models/rails_mini_profiler/sequel_trace.rb
|
136
130
|
- app/models/rails_mini_profiler/trace.rb
|
137
131
|
- app/presenters/rails_mini_profiler/base_presenter.rb
|
138
132
|
- app/presenters/rails_mini_profiler/controller_trace_presenter.rb
|
@@ -191,16 +185,19 @@ files:
|
|
191
185
|
- lib/rails_mini_profiler/request_context.rb
|
192
186
|
- lib/rails_mini_profiler/request_wrapper.rb
|
193
187
|
- lib/rails_mini_profiler/response_wrapper.rb
|
194
|
-
- lib/rails_mini_profiler/
|
195
|
-
- lib/rails_mini_profiler/
|
196
|
-
- lib/rails_mini_profiler/
|
197
|
-
- lib/rails_mini_profiler/
|
198
|
-
- lib/rails_mini_profiler/
|
199
|
-
- lib/rails_mini_profiler/
|
200
|
-
- lib/rails_mini_profiler/
|
201
|
-
- lib/rails_mini_profiler/
|
202
|
-
- lib/rails_mini_profiler/
|
203
|
-
- lib/rails_mini_profiler/
|
188
|
+
- lib/rails_mini_profiler/tracers.rb
|
189
|
+
- lib/rails_mini_profiler/tracers/controller_tracer.rb
|
190
|
+
- lib/rails_mini_profiler/tracers/instantiation_tracer.rb
|
191
|
+
- lib/rails_mini_profiler/tracers/null_trace.rb
|
192
|
+
- lib/rails_mini_profiler/tracers/registry.rb
|
193
|
+
- lib/rails_mini_profiler/tracers/rmp_tracer.rb
|
194
|
+
- lib/rails_mini_profiler/tracers/sequel_tracer.rb
|
195
|
+
- lib/rails_mini_profiler/tracers/sequel_tracker.rb
|
196
|
+
- lib/rails_mini_profiler/tracers/subscriptions.rb
|
197
|
+
- lib/rails_mini_profiler/tracers/trace.rb
|
198
|
+
- lib/rails_mini_profiler/tracers/trace_factory.rb
|
199
|
+
- lib/rails_mini_profiler/tracers/tracer.rb
|
200
|
+
- lib/rails_mini_profiler/tracers/view_tracer.rb
|
204
201
|
- lib/rails_mini_profiler/user.rb
|
205
202
|
- lib/rails_mini_profiler/version.rb
|
206
203
|
- lib/tasks/rails_mini_profiler_tasks.rake
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# == Schema Information
|
4
|
-
#
|
5
|
-
# Table name: rmp_traces
|
6
|
-
#
|
7
|
-
# id :integer not null, primary key
|
8
|
-
# rmp_profiled_request_id :bigint not null
|
9
|
-
# name :string
|
10
|
-
# start :bigint
|
11
|
-
# finish :bigint
|
12
|
-
# duration :integer
|
13
|
-
# allocations :bigint
|
14
|
-
# payload :json
|
15
|
-
# backtrace :json
|
16
|
-
# created_at :datetime not null
|
17
|
-
# updated_at :datetime not null
|
18
|
-
#
|
19
|
-
# Indexes
|
20
|
-
#
|
21
|
-
# index_rmp_traces_on_rmp_profiled_request_id (rmp_profiled_request_id)
|
22
|
-
#
|
23
|
-
module RailsMiniProfiler
|
24
|
-
class ControllerTrace < Trace
|
25
|
-
store :payload, accessors: %i[view_runtime db_runtime]
|
26
|
-
|
27
|
-
class << self
|
28
|
-
def find_sti_class(_)
|
29
|
-
super(name)
|
30
|
-
end
|
31
|
-
|
32
|
-
def sti_name
|
33
|
-
'process_action.action_controller'
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# == Schema Information
|
4
|
-
#
|
5
|
-
# Table name: rmp_traces
|
6
|
-
#
|
7
|
-
# id :integer not null, primary key
|
8
|
-
# rmp_profiled_request_id :bigint not null
|
9
|
-
# name :string
|
10
|
-
# start :bigint
|
11
|
-
# finish :bigint
|
12
|
-
# duration :integer
|
13
|
-
# allocations :bigint
|
14
|
-
# payload :json
|
15
|
-
# backtrace :json
|
16
|
-
# created_at :datetime not null
|
17
|
-
# updated_at :datetime not null
|
18
|
-
#
|
19
|
-
# Indexes
|
20
|
-
#
|
21
|
-
# index_rmp_traces_on_rmp_profiled_request_id (rmp_profiled_request_id)
|
22
|
-
#
|
23
|
-
module RailsMiniProfiler
|
24
|
-
class InstantiationTrace < Trace
|
25
|
-
store :payload, accessors: %i[record_count class_name]
|
26
|
-
|
27
|
-
class << self
|
28
|
-
def find_sti_class(_)
|
29
|
-
super(name)
|
30
|
-
end
|
31
|
-
|
32
|
-
def sti_name
|
33
|
-
'instantiation.active_record'
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# == Schema Information
|
4
|
-
#
|
5
|
-
# Table name: rmp_traces
|
6
|
-
#
|
7
|
-
# id :integer not null, primary key
|
8
|
-
# rmp_profiled_request_id :bigint not null
|
9
|
-
# name :string
|
10
|
-
# start :bigint
|
11
|
-
# finish :bigint
|
12
|
-
# duration :integer
|
13
|
-
# allocations :bigint
|
14
|
-
# payload :json
|
15
|
-
# backtrace :json
|
16
|
-
# created_at :datetime not null
|
17
|
-
# updated_at :datetime not null
|
18
|
-
#
|
19
|
-
# Indexes
|
20
|
-
#
|
21
|
-
# index_rmp_traces_on_rmp_profiled_request_id (rmp_profiled_request_id)
|
22
|
-
#
|
23
|
-
module RailsMiniProfiler
|
24
|
-
class RenderPartialTrace < Trace
|
25
|
-
store :payload, accessors: %i[identifier]
|
26
|
-
|
27
|
-
class << self
|
28
|
-
def find_sti_class(_)
|
29
|
-
super(name)
|
30
|
-
end
|
31
|
-
|
32
|
-
def sti_name
|
33
|
-
'render_partial.action_view'
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# == Schema Information
|
4
|
-
#
|
5
|
-
# Table name: rmp_traces
|
6
|
-
#
|
7
|
-
# id :integer not null, primary key
|
8
|
-
# rmp_profiled_request_id :bigint not null
|
9
|
-
# name :string
|
10
|
-
# start :bigint
|
11
|
-
# finish :bigint
|
12
|
-
# duration :integer
|
13
|
-
# allocations :bigint
|
14
|
-
# payload :json
|
15
|
-
# backtrace :json
|
16
|
-
# created_at :datetime not null
|
17
|
-
# updated_at :datetime not null
|
18
|
-
#
|
19
|
-
# Indexes
|
20
|
-
#
|
21
|
-
# index_rmp_traces_on_rmp_profiled_request_id (rmp_profiled_request_id)
|
22
|
-
#
|
23
|
-
module RailsMiniProfiler
|
24
|
-
class RenderTemplateTrace < Trace
|
25
|
-
store :payload, accessors: %i[identifier]
|
26
|
-
|
27
|
-
class << self
|
28
|
-
def find_sti_class(_)
|
29
|
-
super(name)
|
30
|
-
end
|
31
|
-
|
32
|
-
def sti_name
|
33
|
-
'render_template.action_view'
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# == Schema Information
|
4
|
-
#
|
5
|
-
# Table name: rmp_traces
|
6
|
-
#
|
7
|
-
# id :integer not null, primary key
|
8
|
-
# rmp_profiled_request_id :bigint not null
|
9
|
-
# name :string
|
10
|
-
# start :bigint
|
11
|
-
# finish :bigint
|
12
|
-
# duration :integer
|
13
|
-
# allocations :bigint
|
14
|
-
# payload :json
|
15
|
-
# backtrace :json
|
16
|
-
# created_at :datetime not null
|
17
|
-
# updated_at :datetime not null
|
18
|
-
#
|
19
|
-
# Indexes
|
20
|
-
#
|
21
|
-
# index_rmp_traces_on_rmp_profiled_request_id (rmp_profiled_request_id)
|
22
|
-
#
|
23
|
-
module RailsMiniProfiler
|
24
|
-
class RmpTrace < Trace
|
25
|
-
class << self
|
26
|
-
def find_sti_class(_)
|
27
|
-
super(name)
|
28
|
-
end
|
29
|
-
|
30
|
-
def sti_name
|
31
|
-
'rails_mini_profiler.total_time'
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# == Schema Information
|
4
|
-
#
|
5
|
-
# Table name: rmp_traces
|
6
|
-
#
|
7
|
-
# id :integer not null, primary key
|
8
|
-
# rmp_profiled_request_id :bigint not null
|
9
|
-
# name :string
|
10
|
-
# start :bigint
|
11
|
-
# finish :bigint
|
12
|
-
# duration :integer
|
13
|
-
# allocations :bigint
|
14
|
-
# payload :json
|
15
|
-
# backtrace :json
|
16
|
-
# created_at :datetime not null
|
17
|
-
# updated_at :datetime not null
|
18
|
-
#
|
19
|
-
# Indexes
|
20
|
-
#
|
21
|
-
# index_rmp_traces_on_rmp_profiled_request_id (rmp_profiled_request_id)
|
22
|
-
#
|
23
|
-
module RailsMiniProfiler
|
24
|
-
class SequelTrace < Trace
|
25
|
-
store :payload, accessors: %i[name sql binds]
|
26
|
-
|
27
|
-
class << self
|
28
|
-
def find_sti_class(_)
|
29
|
-
super(name)
|
30
|
-
end
|
31
|
-
|
32
|
-
def sti_name
|
33
|
-
'sql.active_record'
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RailsMiniProfiler
|
4
|
-
module Tracing
|
5
|
-
class TraceFactory
|
6
|
-
class << self
|
7
|
-
def create(event)
|
8
|
-
factory = new(event)
|
9
|
-
factory.create
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def initialize(event)
|
14
|
-
@event = event
|
15
|
-
end
|
16
|
-
|
17
|
-
def create
|
18
|
-
trace_class.new(@event).trace
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def trace_class
|
24
|
-
case @event.name
|
25
|
-
when 'sql.active_record'
|
26
|
-
SequelTracer
|
27
|
-
when 'render_template.action_view', 'render_partial.action_view'
|
28
|
-
ViewTracer
|
29
|
-
when 'process_action.action_controller'
|
30
|
-
ControllerTracer
|
31
|
-
else
|
32
|
-
Tracer
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails_mini_profiler/tracing/subscriptions'
|
4
|
-
require 'rails_mini_profiler/tracing/trace'
|
5
|
-
require 'rails_mini_profiler/tracing/tracer'
|
6
|
-
require 'rails_mini_profiler/tracing/controller_tracer'
|
7
|
-
require 'rails_mini_profiler/tracing/sequel_tracker'
|
8
|
-
require 'rails_mini_profiler/tracing/sequel_tracer'
|
9
|
-
require 'rails_mini_profiler/tracing/view_tracer'
|
10
|
-
require 'rails_mini_profiler/tracing/null_trace'
|
11
|
-
require 'rails_mini_profiler/tracing/trace_factory'
|