MediaWiki master
MediaWiki\Http\Telemetry Class Reference

Service for handling telemetry data. More...

Inherits Wikimedia\Http\TelemetryHeadersInterface.

Collaboration diagram for MediaWiki\Http\Telemetry:

Public Member Functions

 __construct (array $server, bool $allowExternalReqID=null)
 
 getRequestHeaders ()
 Return Telemetry data in form of request headers.
 
 getRequestId ()
 Get the current request ID.
 
 getTraceparent ()
 Get the OpenTelemetry traceparent info, Returns null when not present or AllowExternalReqID is set to false.
 
 getTracestate ()
 Get the OpenTelemetry tracestate info Returns null when not present or AllowExternalReqID is set to false.
 
 overrideRequestId (string $newId)
 Override the unique request ID.
 
 regenerateRequestId ()
 Regenerate the request id by setting it to null, next call to getRequestId will refetch the request id from header/UNIQUE_ID or regenerate it.
 

Static Public Member Functions

static getInstance ()
 

Detailed Description

Service for handling telemetry data.

Stability: unstable
Since
1.41

Definition at line 29 of file Telemetry.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Http\Telemetry::__construct ( array $server,
bool $allowExternalReqID = null )
Parameters
array$serverServer and execution environment information, most likely the $_SERVER variable

Definition at line 55 of file Telemetry.php.

Member Function Documentation

◆ getInstance()

static MediaWiki\Http\Telemetry::getInstance ( )
static

◆ getRequestHeaders()

MediaWiki\Http\Telemetry::getRequestHeaders ( )

Return Telemetry data in form of request headers.

Returns
array

Implements Wikimedia\Http\TelemetryHeadersInterface.

Definition at line 135 of file Telemetry.php.

◆ getRequestId()

MediaWiki\Http\Telemetry::getRequestId ( )

Get the current request ID.

This is usually based on the X-Request-Id header, or the UNIQUE_ID environment variable, falling back to (process cached) randomly-generated string.

Returns
string

Definition at line 77 of file Telemetry.php.

References wfRandomString().

◆ getTraceparent()

MediaWiki\Http\Telemetry::getTraceparent ( )

Get the OpenTelemetry traceparent info, Returns null when not present or AllowExternalReqID is set to false.

Returns
string|null

Definition at line 127 of file Telemetry.php.

◆ getTracestate()

MediaWiki\Http\Telemetry::getTracestate ( )

Get the OpenTelemetry tracestate info Returns null when not present or AllowExternalReqID is set to false.

Returns
string|null

Definition at line 117 of file Telemetry.php.

◆ overrideRequestId()

MediaWiki\Http\Telemetry::overrideRequestId ( string $newId)

Override the unique request ID.

This is for sub-requests, such as jobs, that wish to use the same id but are not part of the same execution context.

Parameters
string$newId

Definition at line 98 of file Telemetry.php.

◆ regenerateRequestId()

MediaWiki\Http\Telemetry::regenerateRequestId ( )

Regenerate the request id by setting it to null, next call to getRequestId will refetch the request id from header/UNIQUE_ID or regenerate it.

Returns
void

Definition at line 107 of file Telemetry.php.


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