[Server Timing] Proposal how a user-agent can request that a server adds the server-timing header response field

On the one hand side Server-Timing information would  very beneficial for some user agents, but on the other hand side many user-agents are not interested in server-timing data.
Have you thought about providing the server timing data via the header field only when they are requested by the client/user-agent? 
One mechanism to request server timing data would be to use a prefer header as specified in rfc 7240 (https://tools.ietf.org/html/rfc7240);
Preference: Server-Timing
Description: Indicates that the client/user-agent prefers that the server adds the header field Server-Timing to the response.

Example:
> GET /resource HTTP/1.1
> Host: example.com
> Prefer: Server-Timing

< HTTP/1.1 200 OK
< Server-Timing: miss, db=53, app=47.2;
< Server-Timing: customView, dc;atl

The prefer header could be automatically set, if an "observer" exists on the client side - e.g. an observer defined in the Java-Script layer or a developer tool in the browser displaying timing data. 

Since this is only  a *preference* of the client, the server still have all the freedom - e.g. the server may only provide metrics to authenticated users or provide metrics to all users independent from the preference header, because the server is in a "performance testing" mode.

-- Martin 

Received on Thursday, 16 June 2016 13:51:17 UTC