Plug to add Server Timings header to your requests
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
lib
test
.gitignore
.travis.yml
README.md
mix.exs
mix.lock

README.md

ExServerTimings

Build Status

This package is a plug to put the http header Server Timings which allow to visualise the server performances in your browser. For more information, refer to this blog and this tweet from Google Chrome devtools.

Installation

The package is available in Hex, the package can be installed by adding ex_server_timings to your list of dependencies in mix.exs:

def deps do
  [{:ex_server_timings, "~> 0.1.0"}]
end

Usage

In your lib/endpoint.ex or in your web/router.ex, add the following line:

plug ExServerTimings.Plug

Todo

Specifications indicate that in case of CORS requests timings should pass Timing-Allow-Origin to allow the user to see timings.

Right now, this are not yet implemented because of the early stage of the standard and low support by browsers.

Also, nothing specifies the unit of metrics passed. Right now we stick to Chrome implementation, but we should be careful of any changes.

License

The MIT License (MIT)

Copyright (c) 2017 Thomas Bracher

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.