default Sidebar.
* The 'vector-simplesearch' preference is now enabled by default. Previously
it was only enabled if the Vector extension was installed.
+* The precise format of metric datagrams produced by the UDP profiler and stats counter
+ may now be specified as $wgUDPProfilerFormatString and $wgStatsFormatString,
+ respectively.
=== New features in 1.22 ===
* (bug 44525) mediawiki.jqueryMsg can now parse (whitelisted) HTML elements and attributes.
*/
$wgUDPProfilerPort = '3811';
+/**
+ * Format string for the UDP profiler. The UDP profiler invokes sprintf() with
+ * (profile id, count, cpu, cpu_sq, real, real_sq, entry name) as arguments.
+ * You can use sprintf's argument numbering/swapping capability to repeat,
+ * re-order or omit fields.
+ *
+ * @see $wgStatsFormatString
+ * @since 1.22
+ */
+$wgUDPProfilerFormatString = "%s - %d %f %f %f %f %s\n";
+
/**
* Detects non-matching wfProfileIn/wfProfileOut calls
*/
*/
$wgAggregateStatsID = false;
+/**
+ * When $wgStatsMethod is 'udp', this variable specifies how stats should be
+ * formatted. Its value should be a format string suitable for a sprintf()
+ * invocation with (id, count, key) arguments, where 'id' is either
+ * $wgAggregateStatsID or the DB name, 'count' is the value by which the metric
+ * is being incremented, and 'key' is the metric name.
+ *
+ * @see $wgUDPProfilerFormatString
+ * @see $wgAggregateStatsID
+ * @since 1.22
+ */
+$wgStatsFormatString = "stats/%s - %s 1 1 1 1 %s\n";
+
/**
* Whereas to count the number of time an article is viewed.
* Does not work if pages are cached (for example with squid).
* @return void
*/
protected function sendDeltasUDP( array $deltas ) {
- global $wgUDPProfilerHost, $wgUDPProfilerPort, $wgAggregateStatsID;
+ global $wgUDPProfilerHost, $wgUDPProfilerPort, $wgAggregateStatsID,
+ $wgStatsFormatString;
$id = strlen( $wgAggregateStatsID ) ? $wgAggregateStatsID : wfWikiID();
$lines = array();
foreach ( $deltas as $key => $count ) {
- $lines[] = "stats/{$id} - {$count} 1 1 1 1 {$key}\n";
+ $lines[] = sprintf( $wgStatsFormatString, $id, $count, $key );
}
if ( count( $lines ) ) {
static $socket = null;
if ( !$socket ) {
$socket = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP );
- array_unshift( $lines, "stats/{$id} - 1 1 1 1 1 -total\n" );
}
$packet = '';
$packets = array();
}
public function logData() {
- global $wgUDPProfilerHost, $wgUDPProfilerPort;
+ global $wgUDPProfilerHost, $wgUDPProfilerPort, $wgUDPProfilerFormatString;
$this->close();
|| !isset( $pfdata['real_sq'] ) ) {
continue;
}
- $pfline = sprintf( "%s %s %d %f %f %f %f %s\n", $this->getProfileID(), "-", $pfdata['count'],
+ $pfline = sprintf( $wgUDPProfilerFormatString, $this->getProfileID(), $pfdata['count'],
$pfdata['cpu'], $pfdata['cpu_sq'], $pfdata['real'], $pfdata['real_sq'], $entry );
$length = strlen( $pfline );
/* printf("<!-- $pfline -->"); */