rails--rails/actionpack/lib
Sebastian Sogamoso 0547b1646d
Add Server Timing middleware (#36289)
* Add Server Timing middleware

What is server timing?
It's a specification that defines how the server can communicate the
user-agent performance metrics about the request it is responding to.

Here's the official specification:
https://www.w3.org/TR/server-timing/#dfn-server-timing-header-field

How does it work?
This introduces a new `ServerTiming` middleware only on `development` by
default, this is done using the `config.server_timing` setting.

It works by subscribing to all `ActiveSupport::Notifications` and adding
their duration to the `Server-Timing` header.

Why is this useful?
It makes looking at performance metrics in development much easier,
especially when using Chrome dev tools which includes the metrics in the
Network Inspector. Here's an example:

![](https://d3vv6lp55qjaqc.cloudfront.net/items/371h2y3B3a0U470j040u/Image%202019-05-15%20at%205.40.37%20PM.png?)

Paired on this with @guilleiguaran
2021-09-19 21:27:07 -07:00
..
abstract_controller Enable `Style/ExplicitBlockArgument` cop 2021-09-05 17:06:19 +02:00
action_controller Only call `wrap_parameters` if it's defined (#43259) 2021-09-19 20:52:52 +02:00
action_dispatch Add Server Timing middleware (#36289) 2021-09-19 21:27:07 -07:00
action_pack Preparing for 7.0.0.alpha2 release 2021-09-15 18:22:51 -04:00
abstract_controller.rb Make sure to require active_support.rb before requiring active_support/rails.rb 2019-07-12 18:30:58 +09:00
action_controller.rb Avoid using class_eval and just include a module 2021-08-17 22:16:06 +00:00
action_dispatch.rb Add Server Timing middleware (#36289) 2021-09-19 21:27:07 -07:00
action_pack.rb Bump license years to 2021 [ci skip] 2021-01-01 12:21:20 +09:00