Class: AppProfiler::Viewer::SpeedscopeRemoteViewer

Inherits:
BaseViewer
  • Object
show all
Includes:
ActiveSupport::Deprecation::DeprecatedConstantAccessor
Defined in:
lib/app_profiler/viewer/speedscope_remote_viewer.rb,
lib/app_profiler/viewer/speedscope_remote_viewer/middleware.rb

Defined Under Namespace

Classes: Middleware

Constant Summary collapse

NAME =
"speedscope"

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseViewer

view

Constructor Details

#initialize(profile) ⇒ SpeedscopeRemoteViewer

Returns a new instance of SpeedscopeRemoteViewer.



23
24
25
26
# File 'lib/app_profiler/viewer/speedscope_remote_viewer.rb', line 23

def initialize(profile)
  super()
  @profile = profile
end

Class Method Details

.remote?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/app_profiler/viewer/speedscope_remote_viewer.rb', line 18

def remote?
  true
end

Instance Method Details

#view(response: nil, autoredirect: nil, async: false) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/app_profiler/viewer/speedscope_remote_viewer.rb', line 28

def view(response: nil, autoredirect: nil, async: false)
  id = Middleware.id(@profile.file)

  if response && response[0].to_i < 500
    response[1]["Location"] = "/app_profiler/#{NAME}/viewer/#{id}"
    response[0] = 303
  else
    AppProfiler.logger.info("[Profiler] Profile available at /app_profiler/#{id}\n")
  end
end