Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Store\Sql\DispatchStats Class Reference

Utility class for collecting dispatch statistics. More...

Public Member Functions

 load ( $now=0)
 Loads the current dispatch status from the database and calculates statistics. More...
 
 hasStats ()
 
 getClientStates ()
 Returns the dispatch state for all client wikis. More...
 
 getClientCount ()
 Returns the number of active client wikis. More...
 
 getFreshest ()
 Returns a dispatch status object for the client wiki that was updated most recently. More...
 
 getStalest ()
 Returns a dispatch status object for the client wiki that was updated least recently. More...
 
 getMedian ()
 Returns a dispatch status object for the client wiki that represents the median in terms of dispatch lag. More...
 
 getAverage ()
 Returns a pseudo-status object representing the average (mean) dispatch lag. More...
 
 getLockedCount ()
 Returns the number of client wikis currently locked. More...
 
 getMaxChangeId ()
 Returns the newest change ID from the changes table. More...
 
 getMinChangeId ()
 Returns the oldest change ID from the changes table. More...
 
 getMaxChangeTimestamp ()
 Returns the newest timestamp from the changes table. More...
 
 getMinChangeTimestamp ()
 Returns the oldest timestamp from the changes table. More...
 

Private Attributes

 $clientStates = null
 
 $changeStats = null
 
 $average = null
 

Detailed Description

Utility class for collecting dispatch statistics.

Note that you must call load() before accessing any getters.

Author
Daniel Kinzler
Thiemo Kreuz

Member Function Documentation

◆ getAverage()

Wikibase\Repo\Store\Sql\DispatchStats::getAverage ( )

Returns a pseudo-status object representing the average (mean) dispatch lag.

The status object has the following fields:

  • chd_untouched: seconds since that client was last touched by a dispatcher
  • chd_pending: number of changes not yet dispatched to that client
  • chd_lag: seconds between the timestamp of the last change that got dispatched and the latest change recorded. May be null if some of the pending changes have already been pruned. This indicates that the average could not be determined, but the lag is large.
Returns
\stdClass

◆ getClientCount()

Wikibase\Repo\Store\Sql\DispatchStats::getClientCount ( )

Returns the number of active client wikis.

Returns
int

◆ getClientStates()

Wikibase\Repo\Store\Sql\DispatchStats::getClientStates ( )

Returns the dispatch state for all client wikis.

The state for each wiki is returned as an object containing the following fields:

  • chd_site: the client wiki's site ID
  • chd_untouched: seconds since that client was last touched by a dispatcher
  • chd_pending: number of changes not yet dispatched to that client
  • chd_lag: seconds between the timestamp of the last change that got dispatched and the latest change recorded. May be null if some of the pending changes have already been pruned. This indicates that the average could not be determined, but the lag is large.
  • chd_lock: the name of the lock currently in effect for that wiki
Returns
\stdClass[]|null A list of objects representing the dispatch state for each client wiki.

◆ getFreshest()

Wikibase\Repo\Store\Sql\DispatchStats::getFreshest ( )

Returns a dispatch status object for the client wiki that was updated most recently.

See getClientStates() for the structure of the status object.

Returns
\stdClass|null

◆ getLockedCount()

Wikibase\Repo\Store\Sql\DispatchStats::getLockedCount ( )

Returns the number of client wikis currently locked.

Note that this does not probe the locks, so they may be stale.

Returns
int

◆ getMaxChangeId()

Wikibase\Repo\Store\Sql\DispatchStats::getMaxChangeId ( )

Returns the newest change ID from the changes table.

Returns
int

◆ getMaxChangeTimestamp()

Wikibase\Repo\Store\Sql\DispatchStats::getMaxChangeTimestamp ( )

Returns the newest timestamp from the changes table.

Returns
string

◆ getMedian()

Wikibase\Repo\Store\Sql\DispatchStats::getMedian ( )

Returns a dispatch status object for the client wiki that represents the median in terms of dispatch lag.

See getClientStates() for the structure of the status object.

Returns
\stdClass|null

◆ getMinChangeId()

Wikibase\Repo\Store\Sql\DispatchStats::getMinChangeId ( )

Returns the oldest change ID from the changes table.

Returns
int

◆ getMinChangeTimestamp()

Wikibase\Repo\Store\Sql\DispatchStats::getMinChangeTimestamp ( )

Returns the oldest timestamp from the changes table.

Returns
string

◆ getStalest()

Wikibase\Repo\Store\Sql\DispatchStats::getStalest ( )

Returns a dispatch status object for the client wiki that was updated least recently.

See getClientStates() for the structure of the status object.

Returns
\stdClass|null

◆ hasStats()

Wikibase\Repo\Store\Sql\DispatchStats::hasStats ( )
Returns
bool

◆ load()

Wikibase\Repo\Store\Sql\DispatchStats::load (   $now = 0)

Loads the current dispatch status from the database and calculates statistics.

Before this method is called, the behavior of the getters is undefined.

Parameters
int | string$nowTimestamp to consider the current time. Mostly useful for testing.
Returns
int the number of client wikis.

Member Data Documentation

◆ $average

Wikibase\Repo\Store\Sql\DispatchStats::$average = null
private

◆ $changeStats

Wikibase\Repo\Store\Sql\DispatchStats::$changeStats = null
private

◆ $clientStates

Wikibase\Repo\Store\Sql\DispatchStats::$clientStates = null
private

The documentation for this class was generated from the following file: