40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/new_relic/rack/metric_app.rb', line 40
def call(env)
request = ::Rack::Request.new env
data_url = "http://#{env['HTTP_HOST']}/metrics/path?value=nnn"
body = StringIO.new
body.puts "<html><body>"
body.puts "<h1>New Relic Actively Monitoring #{NewRelic::Control.instance.app_names.join(' and ')}</h1>"
body.puts "<p>To submit a metric value, use <a href='#{data_url}'>#{data_url}</a></p>"
body.puts "<h2>Request Details</h2>"
body.puts "<dl>"
body.puts "<dt>ip<dd>#{request.ip}"
body.puts "<dt>host<dd>#{request.host}"
body.puts "<dt>path<dd>#{request.url}"
body.puts "<dt>query<dd>#{request.query_string}"
body.puts "<dt>params<dd>#{request.params.inspect}"
body.puts "</dl>"
body.puts "<h2>Complete ENV</h2>"
body.puts "<ul>"
body.puts env.to_a.map{|k,v| "<li>#{k} = #{v}</li>" }.join("\n")
body.puts "</ul></body></html>"
response = ::Rack::Response.new body.string
response.finish
end
|