Skip to content

Commit

Permalink
Add NewRelic RPM
Browse files Browse the repository at this point in the history
  • Loading branch information
judofyr committed Nov 18, 2010
1 parent 3a4cd20 commit 9d1daab
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Gemfile
Expand Up @@ -11,3 +11,6 @@ gem "haml"
gem "maruku"
gem "ultraviolet"

# New Relic
gem "newrelic_rpm"

2 changes: 2 additions & 0 deletions Gemfile.lock
Expand Up @@ -6,6 +6,7 @@ GEM
haml (3.0.21)
maruku (0.6.0)
syntax (>= 1.0.0)
newrelic_rpm (2.13.3)
oniguruma (1.1.0)
plist (3.1.0)
rack (1.2.1)
Expand All @@ -24,5 +25,6 @@ DEPENDENCIES
camping
haml
maruku
newrelic_rpm
tilt
ultraviolet
6 changes: 6 additions & 0 deletions config.ru
@@ -1,2 +1,8 @@
require 'timeless'

if ENV['RACK_ENV'] != "production"
require 'new_relic/rack/developer_mode'
use NewRelic::Rack::DeveloperMode
end

run Timeless
11 changes: 10 additions & 1 deletion timeless.rb
Expand Up @@ -10,6 +10,10 @@
require 'maruku'
require './maruku-uv'

require 'new_relic/agent'
require 'new_relic/agent/instrumentation/controller_instrumentation'
NewRelic::Agent.manual_start

Camping.goes :Timeless

require './timeless/models/entry'
Expand All @@ -18,6 +22,8 @@
class NotFound < StandardError; end

module Timeless
include NewRelic::Agent::Instrumentation::ControllerInstrumentation

set :views, File.dirname(__FILE__) + '/timeless/views'
set :dynamic_templates, true
set :last_modified, Time.now
Expand All @@ -38,7 +44,10 @@ def service(*a)
end

@headers['Last-Modified'] = Timeless.options[:last_modified].rfc2822
super

perform_action_with_newrelic_trace(:category => :rack) do
super
end
rescue NotFound
@status = 404
@method = :r404
Expand Down

0 comments on commit 9d1daab

Please sign in to comment.