GithubHelp home page GithubHelp logo

peek / peek-rblineprof Goto Github PK

View Code? Open in Web Editor NEW
235.0 11.0 31.0 25 KB

Peek into how much each line of your Rails application takes throughout a request.

License: MIT License

Ruby 53.08% CSS 41.72% HTML 3.87% JavaScript 1.33%
peek ruby

peek-rblineprof's Introduction

Peek::Rblineprof

Peek into how much time each line of your Rails application takes throughout a request.

Things this peek view provides:

  • Total time it takes to render individual lines within your codebase
  • Total network time spent waiting per line

You can also drill down to only certain parts of your codebase like:

  • app, everything within Rails.root/(app|lib)
  • views, everything within Rails.root/app/view
  • gems, everything within Rails.root/vendor/gems
  • all, everything within Rails.root
  • stdlib

screen shot 2013-05-06 at 5 08 45 pm

Installation

Add this line to your application's Gemfile:

gem 'peek-rblineprof'

And then execute:

$ bundle

Or install it yourself as:

$ gem install peek-rblineprof

Usage

Add the following to your config/initializers/peek.rb:

Peek.into Peek::Views::Rblineprof

You'll then need to add the following CSS and CoffeeScript:

CSS:

//= require peek
//= require peek/views/rblineprof

CoffeeScript:

#= require peek
#= require peek/views/rblineprof

Integration with pygments.rb

By default peek-rblineprof renders the code of each file in plain text with no syntax highlighting for performance reasons. If you'd like to have your code highlighted as it does on GitHub.com, just include the pygments.rb gem:

gem 'pygments.rb', :require => false

peek-rblineprof will now highlight each file for you, but there's one more thing...

To use the default theme that peek-rblineprof provides just add the following to your peek specific or application stylesheet:

//= require peek/views/rblineprof/pygments

That's it! Now your code will look โœจ

Contributors

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

peek-rblineprof's People

Contributors

8398a7 avatar bakunyo avatar dewski avatar kerrizor avatar rymai avatar wa0x6e avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

peek-rblineprof's Issues

Error on startup

When adding and trying to fire up a rails app I get:

/Users/ccunningham/.rvm/gems/ruby-1.9.3-p385/gems/peek-rblineprof-0.1.0/lib/peek/views/rblineprof.rb:5:in `module:Views': uninitialized constant Peek::Views::View (NameError)

Indeed it's trying to subclass a View but I'm not entirely sure what class it's trying to subclass in there...

Error on startup

rails s
=> Booting Thin
=> Rails 4.0.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/Users/nico/Rails/new_yousty/yousty/config/initializers/peek.rb:1:in `<top (required)>': undefined method `into' for Peek:Module (NoMethodError)

Feature request: close or hide button

A simple (x) close button for hiding the overlays would be great. Right now they stay on top and I have no way to close them except doing a refresh of the page. When using pjax they also sometimes stay open on the next request or showing double ... old and new request windows will show on top of each other ...

Incorrect line profiling in views

First of all, thanks for the effort in this gem.

Take a look at the following SS:

image

I'll try to describe what I think the incorrect behavior is (please look at the number on SS):

  • There's no ruby on (1) (doctype), (2) (meta viewport) and (3) (link rel manifest), so I don't get why there's profiling there
  • On (4), there's ruby but there's no profiling;
  • On (5) and (6), there's ruby but it's a comment, unlikely it's taking all that time;
  • On (7), it shows it took 186 ms to render the csrf_meta_tag, which is unlikely; it also shows it took 0 ms to render the previous line (the stylesheet include), which was the culprit (as I show below).

So, to test, I removed the csrf_tag, and it showed that huge time in the next line (not the previous one) ... If I keep removing them, you'll see that huge time assigned to a line that has no ruby on it:

image

I wondered if everything was just offset by one line but it's irregular, as you can check if you analyze line by line.

In controllers profilling this does not seem to happen.

Output/display error when Pygments isn't present

If pygments.rb isn't present then the output isn't readable/correct; it appears to be partially rendering the file content into the page as actual markup, triggering JavaScript events, malformed Ajax calls, and the like. You can see in the image below that the top-level <html> tags aren't displaying as part of the escaped layout in the right panel.

I wasn't seeing an interesting backtrace, but the error was consistent on every request. I wound up just adding pygments to get highlighted output. If you'd like help gathering more useful debugging data, let me know and I'll play around without pygments enabled again.

Fwd_ Broken links on GitHub Blog page-2

Modal never displays

I believe I have correctly installed peek-rblineprof into my Rails app (it's a rails 3.2 app) and I also installed pygments and the other related gems since other issues mentioned that that can prevent the gem from working.

The JS and CSS are in my app, but the peek element never ends up in the DOM and nothing ever appears.

I have verified that the initializer is indeed loading, but I'm not really sure what I should do to troubleshoot further. Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.