rails3里的notification/subscription ... no reply

2010-10-09 16:35

rails3里的notification/subscription ... no reply

by Latest from ChinaonRails

at 2010-10-09 08:35:33

original http://feedproxy.google.com/~r/LatestFromChinaonrails/~3/HTmMTHSuUTc/4519.html

Instrument Anything in Rails 3

http://gist.github.com/566725

Rails 3, logging 抽象到ActiveSupport::Notifications 管发布logging事件

ActiveSupport::LogSubscriber, 则消费 events 并负责logs 输出结果

抽象的好处就是可以让更多的实体来发布事件,任何实体都能被量度了

Rails 3's notifications 开放出更大的可能性来做publishing 发布 subscribing 订阅 events事件。

文章中队改进对自定义log事件的记录响应,以SolrInstrumentation 为例
得出自己的的log,包含了查询的时间

Completed 200 OK in 562ms (Views: 507.9ms | ActiveRecord: 406.3ms | Solr: 52.2ms)


另外的着力点在目前广泛采用的nosql上,比如MongoDB or CouchDB 替代 ActiveRecord ,关注它们的效率而产生的log需求。