Class: OneApm::Rack::DeveloperMode

Inherits:
MiddlewareBase show all
Includes:
DeveloperModeHelper
Defined in:
lib/one_apm/rack/developer_mode.rb

Constant Summary collapse

OA_VIEW_PATH =
File.expand_path('../developer_mode/views/', __FILE__)

Constants included from CollectionHelper

CollectionHelper::OA_DEFAULT_ARRAY_TRUNCATION_SIZE, CollectionHelper::OA_DEFAULT_TRUNCATION_SIZE

Constants included from MiddlewareTracing

MiddlewareTracing::OA_TXN_STARTED_KEY

Instance Attribute Summary

Attributes inherited from MiddlewareBase

#category, #target, #transaction_options

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CollectionHelper

#normalize_params, #strip_oa_from_backtrace

Methods inherited from MiddlewareBase

#build_transaction_name, #initialize, #middleware_ignore?

Methods included from MiddlewareHelper

#close_old_response, #gather_source, #middleware_ignore?

Methods included from MiddlewareTracing

#_oa_has_middleware_tracing, #build_transaction_options, #call, #capture_http_response_code, #events, #merge_first_middleware_options, #note_transaction_started

Constructor Details

This class inherits a constructor from OneApm::Rack::MiddlewareBase

Class Method Details

.profiled=(profiled) ⇒ Object



43
44
45
# File 'lib/one_apm/rack/developer_mode.rb', line 43

def self.profiled=(profiled)
  @profiled = profiled
end

.profiled?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/one_apm/rack/developer_mode.rb', line 39

def self.profiled?
  @profiled 
end

Instance Method Details

#traced_call(env) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/one_apm/rack/developer_mode.rb', line 26

def traced_call(env)
  @req = ::Rack::Request.new(env)
  @start_memory_used = current_memory_used
  return dup._call(env) if /^\/oneapm/ =~ @req.path_info
  set_profiled
  status, headers, body = @app.call(env)  
  if status == 200 && headers['Content-Type'] =~ /text\/html/
    result = inject_profiler(env, status, headers, body)
    return result if result
  end
  return [status, headers, body]
end