Created
April 29, 2015 09:42
-
-
Save luxflux/55a082f2f0892696b9d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if Rails.env.production? | |
InfluxDB::Rails.configure do |config| | |
config.async = true | |
config.instrumentation_enabled = false | |
end | |
ActiveSupport::Notifications.subscribe 'process_action.action_controller' do |name, started, finished, unique_id, payload| | |
log = { | |
http_status: payload[:status], | |
uri: payload[:path], | |
view_runtime: (payload[:view_runtime] || 0).ceil, | |
db_runtime: (payload[:db_runtime] || 0).ceil, | |
total_runtime: ((finished - started)*1000).ceil, | |
hostname: Socket.gethostname, | |
} | |
InfluxDB::Rails.client.write_point('rails.logs', log) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment