Module: AppProfiler

Defined in:
lib/app_profiler/server.rb,
lib/app_profiler.rb,
lib/app_profiler/profile.rb,
lib/app_profiler/railtie.rb,
lib/app_profiler/version.rb,
lib/app_profiler/profiler.rb,
lib/app_profiler/middleware.rb,
lib/app_profiler/yarn/command.rb,
lib/app_profiler/request_parameters.rb,
lib/app_profiler/viewer/base_viewer.rb,
lib/app_profiler/storage/base_storage.rb,
lib/app_profiler/storage/file_storage.rb,
lib/app_profiler/yarn/with_speedscope.rb,
lib/app_profiler/middleware/base_action.rb,
lib/app_profiler/middleware/view_action.rb,
lib/app_profiler/middleware/upload_action.rb,
lib/app_profiler/viewer/speedscope_viewer.rb,
lib/app_profiler/storage/google_cloud_storage.rb,
lib/app_profiler/viewer/speedscope_remote_viewer.rb,
lib/app_profiler/viewer/speedscope_remote_viewer/middleware.rb,
lib/app_profiler/viewer/speedscope_remote_viewer/base_middleware.rb

Overview

This module provides a means to start a golang-inspired profile server it is implemented using stdlib and Rack to avoid additional dependencies

Defined Under Namespace

Modules: Server, Storage, Viewer, Yarn Classes: ConfigurationError, Middleware, Profile, Railtie, RequestParameters

Constant Summary collapse

DefaultProfileFormatter =
proc do |upload|
  "#{AppProfiler.speedscope_host}#profileURL=#{upload.url}"
end
VERSION =
"0.1.3"

Class Method Summary collapse

Class Method Details

.profile_data_headerObject



74
75
76
# File 'lib/app_profiler.rb', line 74

def profile_data_header
  @@profile_data_header ||= profile_header.dup << "-Data" # rubocop:disable Style/ClassVars
end

.profile_header=(profile_header) ⇒ Object



64
65
66
67
68
# File 'lib/app_profiler.rb', line 64

def profile_header=(profile_header)
  @@profile_header = profile_header # rubocop:disable Style/ClassVars
  @@request_profile_header = nil    # rubocop:disable Style/ClassVars
  @@profile_data_header = nil       # rubocop:disable Style/ClassVars
end

.profile_url(upload) ⇒ Object



82
83
84
85
86
# File 'lib/app_profiler.rb', line 82

def profile_url(upload)
  return unless AppProfiler.profile_url_formatter

  AppProfiler.profile_url_formatter.call(upload)
end

.profile_url_formatter=(block) ⇒ Object



78
79
80
# File 'lib/app_profiler.rb', line 78

def profile_url_formatter=(block)
  @@profile_url_formatter = block # rubocop:disable Style/ClassVars
end

.request_profile_headerObject



70
71
72
# File 'lib/app_profiler.rb', line 70

def request_profile_header
  @@request_profile_header ||= profile_header.upcase.tr("-", "_").prepend("HTTP_") # rubocop:disable Style/ClassVars
end

.run(*args, &block) ⇒ Object



51
52
53
# File 'lib/app_profiler.rb', line 51

def run(*args, &block)
  Profiler.run(*args, &block)
end

.start(*args) ⇒ Object



55
56
57
# File 'lib/app_profiler.rb', line 55

def start(*args)
  Profiler.start(*args)
end

.stopObject



59
60
61
62
# File 'lib/app_profiler.rb', line 59

def stop
  Profiler.stop
  Profiler.results
end