Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rails-middleware_timer

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rails-middleware_timer

  • 0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

MiddlewareTimer :clock1:

Build Status

A Rack middleware timer for Rails 4 and 5. Outputs results in miliseconds like so:

Started GET "/health" for 127.0.0.1 at 2016-12-15 23:39:19 +0000
  ActiveRecord::SchemaMigration Load (0.4ms)  SELECT "schema_migrations".* FROM "schema_migrations"
Processing by HealthController#show as HTML
Completed 200 OK in 0ms (ActiveRecord: 0.0ms)

Sample message for Rack::Runtime ==> 22 ms
Sample message for ActionDispatch::Executor ==> 21 ms
Sample message for ActionDispatch::Static ==> 70 ms
Sample message for Rack::Sendfile ==> 70 ms

Installation

Put the following in your Gemfile:

gem 'rails-middleware_timer',
    git: 'git://github.com/humzashah/rails-middleware_timer.git'

and bundle install.

Then add the following to your environment.rb file:

# config/environment.rb

# after: Rails.application.initialize!
Rails::MiddlewareTimer.time!

You can use a custom message format / method like so:

# config/initializers/rails-middleware_timer.rb

require 'rails/middleware_timer'

module Rails
  module MiddlewareTimer
    module Timer
      module_function

      def custom_output(class_name, time_taken)
        puts "Sample message for #{class_name} ==> #{time_taken}"
      end
    end
  end
end

FAQs

Package last updated on 16 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc