Runtime in Server-Timing header
Server-Timing is the standard way to report server performance to the user agent nowadays. I like that it's standardized around reporting milliseconds, and this is presented meaningfully in web browsers dev tools.
This PR introduces Rack::ServerTiming to set (or append to) the Server-Timing response header, with a duration measurement value, similar to the existing Rack::Runtime middleware.
I can't think of a situation where I'd want both headers, one with seconds and one with milliseconds.
That's fair. Happy to split this out into Rack::ServerTiming.
this overrides an existing server-timing header
I don't think my implementation does, does it?
this overrides an existing server-timing header
I don't think my implementation does, does it?
No, it doesn't, sorry about that.
Thanks for your initial review @jeremyevans. I've addressed it with a new Rack::ServerTiming middleware here.
It looks like the external test failure is unrelated.
Failure message
1) Rack::Sendfile when calling sendfile contains Sendfile headers
Failure/Error: expect(headers).to include('X-Accel-Redirect')
expected {"cache-control" => "no-cache", "content-type" => "application/json"} to include "X-Accel-Redirect"
Diff:
@@ -1 +1,2 @@
-["X-Accel-Redirect"]
+"cache-control" => "no-cache",
+"content-type" => "application/json",
# ./spec/grape/integration/rack_sendfile_spec.rb:34:in `block (3 levels) in <top (required)>'