Module: NewRelic::Agent::Instrumentation::QueueTime

Included in:
ControllerInstrumentation
Defined in:
lib/new_relic/agent/instrumentation/queue_time.rb

Constant Summary collapse

MAIN_HEADER =
'HTTP_X_REQUEST_START'
MIDDLEWARE_HEADER =
'HTTP_X_MIDDLEWARE_START'
QUEUE_HEADER =
'HTTP_X_QUEUE_START'
ALT_QUEUE_HEADER =
'HTTP_X_QUEUE_TIME'
HEROKU_QUEUE_HEADER =
'HTTP_X_HEROKU_QUEUE_WAIT_TIME'
APP_HEADER =
'HTTP_X_APPLICATION_START'
HEADER_REGEX =
/([^\s\/,(t=)]+)? ?t=([0-9]+)/
SERVER_METRIC =
'WebFrontend/WebServer/'
MIDDLEWARE_METRIC =
'Middleware/'
ALL_SERVER_METRIC =

no individual queue metric - more than one queue?!

'WebFrontend/WebServer/all'
ALL_MIDDLEWARE_METRIC =
'Middleware/all'
ALL_QUEUE_METRIC =
'WebFrontend/QueueTime'

Instance Method Summary collapse

Instance Method Details

#parse_frontend_headers(headers) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/new_relic/agent/instrumentation/queue_time.rb', line 22

def parse_frontend_headers(headers)
  # these methods add internal state, so we dup so other parts
  # of the app don't have to worry about it.
  # May have performance implications with very large env hashes
  env = headers.dup
  add_end_time_header(Time.now, env)
  middleware_start = parse_middleware_time_from(env)
  queue_start = parse_queue_time_from(env)
  server_start = parse_server_time_from(env)
  # returned for the controller instrumentation
  [middleware_start, queue_start, server_start].min
end