-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Oink with Rails 3 #5
Comments
I don't know anyone who's yet tested or tried it with rails 3, I'm afraid. It's definitely next on my list. The new instrumentation stuff should make some of the hoops we're jumping through a bit simpler too. |
A nice Rails 3 centric feature would be to support ActionController::Metal, by making the Oink modules ActiveSupport::Concern and pulling in anything they depend on (like filters). |
has anyone tried this? would love to know |
I gave this a shot and it seems to work fine in rails3. The only rails hooks that it's relying on really are around/after filters on controllers which still exist. It can be installed as a gem and included in your Gemfile for your app. Let me know if you have any issues. |
Ok, as I've been working towards a 1.0 release, I realized that while my earlier statement is true, it does log fine in rails3, the log format changed slightly in rails3, which breaks the parsing of the logs. I have this fixed in master, which uses middleware instead of controller filters, and writes to its own separate log. |
Using a custom log file breaks the request-log-analyzer gem in a way that is not easily resolvable (it would have to correlate entries across two log files) which in turn breaks ScoutApp's support of Oink. Can't it go back to using the Rails logger if Rails is loaded? We have been successfully using Scout to monitor Oink in Rails 3 but this change will break that. |
Hey Chris - Thanks for bringing this to my attention and sorry I introduced a change which breaks ScoutApp's support of Oink. First, since I already pushed an "0.9.1" release, make sure to freeze support at "0.1.2" until we are able to resolve this issue. Oink version 0.1.2 does not work with Rails 3 applications - the reason for this is that Oink's log parser was reading lines written both by Oink and by Rails, and the lines written by Rails changed from version 2.x and 3.x. I was uncomfortable with this fragility and coupling with Rails version-specific logging lines, and it struck me that if Oink was writing the relevant lines instead of Rails, it would be isolated from Rails logging changes, and furthermore, would allow oink to be framework-agnostic (Sinatra, etc). Any application that reads the Rails log for this specific information is going to have this same issue. I am comfortable re-introducing the ability of Oink to write to the Rails log (or its own log), but only when it is resilient to framework logging changes. To do this will probably involve:
Apologies for the length of this response, but prior to recently I wasn't aware that others were hinged to Oink's log format, which means changes to Oink's log format are going to require greater collaboration that I had envisioned. Let me know your thoughts on this. |
Well I can only respond from the perspective of my use cases. My use cases involve using Oink::MemoryUsageLogger with Rails 2 and 3 and Oink::InstanceTypeCounter with Rails 2 (the Rails 3 app does not use ActiveRecord). I use those combined with the request-log-analyzer gem (via ScoutApp's #1 plugin, the Rails log analyzer) which already handles both the Rails 2 and Rails 3 log formats, but to parse the Oink information it must be within the same log file. So my use case never intersects with Oink's built-in log parser. Is there anyway to leverage the work that the request-log-analyzer has done? I'm definitely not a fan of adding duplication to the log files since apps with a lot of traffic already generate large enough logs that they're hard to efficiently parse on a nightly basis. An Oink prefix would break the current version of the parser but it would be a simple patch to fix that so I'm not worried about that change. |
Hi Chris - I just pushed a 0.9.2 which hopefully addresses your concerns. You can now log to the rails log but configuring the middleware like so in a rails initializer:
It does for now log a bit of duplicate information, because that was the easiest way to support request log analyzer while remaining framework-agnostic. Let me know if this solution works for you. Over time, I'd like flexibility in changing the oink log format, but it seems this may prove challenging if request log analyzer has its own parser. Might be worth considering how we can consolidate the different log parsers. Perhaps oink should be split into a parser and a logger, and both request log analyzer and oink logger can rely on the oink parser. |
I'm getting this error on rails3 - its in my gemfile, and in my initializer I have
|
Looks like you have one too many "Oink::Middlewares" in there. Try this:
|
Thanks! Strangely OSX memory reports 2.6 GB from 'ps' which is wrong according to activity log. It's just my dev environment though so not a huge deal, and hopefully the deltas will end up right. inspire 5020 0.3 3.1 2638624 192580 s000 S 11:39AM 0:07.92 /Users/inspire/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby script/rails server activity manager shows 188MB vsize, 206MB memory size. On linux the processes are about 120MB (which seems normal for a large-sized rails3 app?) |
Any tips how to set the default rails logger to be a hotel_3000_complaint one? The github project for that hasn't been updated in forever & it's docs are now missing. How does one reopen the Rails.logger, or re-assign it to a subclassed version of itself... Thanks, On May 1, 2011, at 9:41 AM, noahd1 wrote:
|
For rails3, you'll want the following line in application.rb or in one of your environment files:
rails2 uses "config.log_path" instead of config.paths.log.first |
In Rails 3.1 > config.paths.log.first as been deprecated: http://guides.rubyonrails.org/3_2_release_notes.html Use
instead. |
For anyone reading the comment from @noahd1, I think that should be
|
Does Oink work with rails 3 ?
And if yes, how does we need to install it ?
Thanks a lot,
The text was updated successfully, but these errors were encountered: