Manual:Hooks/ApiMaxLagInfo

From mediawiki.org
ApiMaxLagInfo
Available from version 1.32.0
Called right before giving out information about max lag in API
Define function:
public static function onApiMaxLagInfo( array &$lagInfo ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ApiMaxLagInfo": "MediaWiki\\Extension\\MyExtension\\Hooks::onApiMaxLagInfo"
	}
}
Called from: File(s): api/ApiMain.php
Interface: ApiMaxLagInfoHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:ApiMaxLagInfo extensions.


Details[edit]

Use this to override lag information. Generally a hook function should only replace $lagInfo if the new $lagInfo['lag'] is greater than the current $lagInfo['lag'].

  • &$lagInfo: Maximum lag information array. Fields in the array are:
    • 'lag' is the number of seconds of lag.
    • 'host' is the host name on which the lag exists.
    • 'type' is an indication of the type of lag, e.g. "db" for database replication lag or "jobqueue" for job queue size converted to pseudo-seconds.
    • It is possible to add more fields and they will be returned to the user in the API response.