Plack::Middleware::ServerTiming - Performance metrics in Server-Timing header
use Plack::Builder; builder { enable 'ServerTiming'; sub { my $env = shift; sleep 1; push @{$env->{'psgix.server-timing'}}, ['miss']; push @{$env->{'psgix.server-timing'}}, ['sleep', {dur => 1000, desc => 'Sleep one second...'}]; [200, ['Content-Type','text/html'], ["OK"]]; }; };
Plack::Middleware::ServerTiming is middleware to add Server-Timing header on your response. You may set psgix.server-timing environment value to specify name, duration and description as metrics.
Server-Timing
psgix.server-timing
$env->{'psgix.server-timing'} = [ [$name], [$name, {dur => $duration}], [$name, {desc => $description}], [$name, {dur => $duration, desc => $description}], ];
https://www.w3.org/TR/server-timing/
Copyright (C) Takumi Akiyama.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Takumi Akiyama <t.akiym@gmail.com>
To install Plack::Middleware::ServerTiming, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack::Middleware::ServerTiming
CPAN shell
perl -MCPAN -e shell install Plack::Middleware::ServerTiming
For more information on module installation, please visit the detailed CPAN module installation guide.