Is the default rails controller # action runtime reliable and correct?

to check the runtime. I am using this code:

ActiveSupport::Notifications.subscribe 'process_action.action_controller' do |*args|
  event = ActiveSupport::Notifications::Event.new(*args)
  puts "Event received: #{event.duration}"
end

For a request that takes 137 ms, it shows only 34 ms, but I saw in the postman and pingdom, it takes 137 ms.

So where is the remaining time of 100 ms?

See screenshot: Rails log

It says that the request took 25 ms, but in the mail man it took 90 ms, so where did the remaining 65 ms go?

I know that due to network and internet speed, it is also important for full rendering.

I just want to confirm that this is the correct time or something is missing here, for example, if the ApplicationController has a filter:

before_action :method_name

Then it considers the action "method_name" also or only the current action?

+4
1

, 100 ?

. ( pingdom) ( ). Rails ( , ), .

:

Rails log

before_action . , , .

, :

ActiveSupport::Notifications.subscribe 'process_action.action_controller' do |*args|
  event = ActiveSupport::Notifications::Event.new(*args)
  puts "Event received: #{event.duration}"
end

, .

+3

Source: https://habr.com/ru/post/1686954/


All Articles