NAME

Web::VWF::Display::meta_data - The status page: the server and its traffic

VERSION

Version 0.003.0

DESCRIPTION

A dashboard for the site's owner. It reads the access log through the vwf_log handle (see Web::VWF::Data::vwf_log) and shows the server's load, memory, disk and uptime, the counts of requests, and five HTML::D3 charts: the browser types, the HTTP status codes, requests and errors per hour, latency per hour, and the slowest endpoints. A chart with nothing to draw is replaced by a sentence saying so. It needs HTML::D3 0.30 or later.

METHODS

html

Needs the vwf_log handle and dies without it. Returns the HTML from meta_data.tmpl.

API SPECIFICATION

INPUT

{ vwf_log => { type => 'object' } }

OUTPUT

{ type => 'string' }

get_server_metrics

The state of the server as a hash reference: cpu_count, cpu_type, disk_used_pct (undef when Filesys::Df is not installed) and memory_used_pct.

get_traffic_metrics

Takes the log handle and the domain name. Returns a hash reference with requests_per_hour, active_users (distinct addresses) and errors_last_hour for the last hour.

get_request_rate_24h

Takes the log handle and the domain name. Returns { total, errors, error_pct }, each a list of [ hour, value ] pairs for the last 24 hours.

get_latency_24h

Takes the log handle and the domain name. Returns { avg, p95 }, each a list of [ hour, milliseconds ] pairs for the last 24 hours. Durations over a day are log rows written by an old bug and are left out.

get_slow_endpoints_24h

Takes the log handle and the domain name. Returns up to ten [ template, milliseconds ] pairs, the 95th percentile of the slowest templates in the last 24 hours, ignoring any that were asked for fewer than five times.

AUTHOR

Nigel Horne, <njh at nigelhorne.com>

LICENCE AND COPYRIGHT

Copyright 2010-2026 Nigel Horne.

Usage is subject to the GPL2 licence terms. If you use it, please let me know.