Extension:EnhancedReportTime

From mediawiki.org
MediaWiki extensions manual
EnhancedReportTime
Release status: stable
Implementation Page action
Description Displays enhanced information about generation time of wiki pages
Author(s) Dāvis Mošenkovs (DavisNTtalk)
Latest version 1.1.0 (2022-02-24)
MediaWiki MW 1.21+ (most likely works also on older versions)
Database changes No
License GNU General Public License 2.0 or later
Download Download instructions

  • $wgERTUseServerStartTime
  • $wgERTSLATime
  • $wgERTTestFunction
  • $wgERTPages

The EnhancedReportTime extension adds HTML comment with page generation time and information whether a predefined page generation time limit (usually SLA requirement) has been met. The HTML comment also includes request start time source ($wgRequestTime or $_SERVER['REQUEST_TIME_FLOAT']).

Usage[edit]

After plugin installation on specified pages (or entire wiki) additional information about page generation time is shown.

This allows more effective usage of webpage monitoring software/services lacking configurable request timeouts, but offering page content checking. When using EnhancedReportTime such monitoring service can be set to check a specific page with desired content length, complexity, importance and protection (e.g. Special:Version), and search for "SLA of XX secs met." in it. This way a basic request time monitoring can be achieved.

Ensure that HTML comment on the monitored page doesn't get cached by anything (e.g. a caching proxy).
The EnhancedReportTime extension does not count entire request processing time on the server (although it tries to get request start time from the web server and counts the elapsed time very late in the page processing) as well as network latency. This extension is not a replacement for full featured monitoring solution.

Download instructions[edit]

Download both .php files from GitHub (feel free to move this repository to MediaWiki Git) and place them in $IP/extensions/EnhancedReportTime/.

Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php .

Installation[edit]

To load this extension, add the following to LocalSettings.php :

require_once("$IP/extensions/EnhancedReportTime/EnhancedReportTime.php");

Afterwards (if required) place configuration parameters in LocalSettings.php (default values are shown here):

$wgERTUseServerStartTime = true;
If available, use request start timestamp from $_SERVER['REQUEST_TIME_FLOAT'] instead of $wgRequestTime. This should allow to count some more server overhead. Works on PHP 5.4.0+.
$wgERTSLATime = 10;
Maximum allowed generation time for which to report that SLA is met. Setting this to 0 suppresses SLA message.
$wgERTTestFunction = '';
Name of PHP function with additional tests. This function must return true on success or string with error message on failure. Error message will be displayed instead of SLA of XX secs met./SLA of XX secs NOT met. message. Execution time of this function is included in page generation time.
$wgERTPages = array('Special:Version');
Array with page names (see magic word {{FULLPAGENAME}}) where to enable EnhancedReportTime. Setting this to empty enables EnhancedReportTime on every page.