Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
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.
 
 hasStats ()
 
 getClientStates ()
 Returns the dispatch state for all client wikis.
 
 getClientCount ()
 Returns the number of active client wikis.
 
 getFreshest ()
 Returns a dispatch status object for the client wiki that was updated most recently.
 
 getStalest ()
 Returns a dispatch status object for the client wiki that was updated least recently.
 
 getMedian ()
 Returns a dispatch status object for the client wiki that represents the median in terms of dispatch lag.
 
 getAverage ()
 Returns a pseudo-status object representing the average (mean) dispatch lag.
 
 getLockedCount ()
 Returns the number of client wikis currently locked.
 
 getMaxChangeId ()
 Returns the newest change ID from the changes table.
 
 getMinChangeId ()
 Returns the oldest change ID from the changes table.
 
 getMaxChangeTimestamp ()
 Returns the newest timestamp from the changes table.
 
 getMinChangeTimestamp ()
 Returns the oldest timestamp from the changes table.
 

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: