rails activesupport notifications - wrong db runtime value

后端 未结 3 1859
执笔经年
执笔经年 2021-02-20 08:38

I\'m trying to log requests for my REST API application. I\'m using rails notifications for this , like here http://railscasts.com/episodes/249-notifications-in-rails-3

3条回答
  •  悲哀的现实
    2021-02-20 09:03

    The Rails instrumentation works by wrapping the request at the Rack metal level and recording events for the different metrics. In both cases, the entire block should be wrapped and tracked by the standard instrumentation.

    The only difference I can see after digging into the source is calling save() vs. save!(). It looks like the underlying method event subscriptions in ActiveRecord may behave differently.

    Try changing your respond_with() example to use save vs. save! and see if it records the db_runtime properly? If so, that's a Rails bug, and you can work around it by mimicking the save! features using save.

提交回复
热议问题