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 15 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 37 of file Telemetry.php.

Member Function Documentation

◆ getInstance()

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

Definition at line 42 of file Telemetry.php.

References $wgAllowExternalReqID.

Referenced by MediaWiki\Http\HttpRequestFactory\createMultiClient().

◆ getRequestHeaders()

MediaWiki\Http\Telemetry::getRequestHeaders ( )

Return Telemetry data in form of request headers.

Implements Wikimedia\Http\TelemetryHeadersInterface.

Definition at line 112 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.

Definition at line 57 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 105 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 95 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.

Definition at line 76 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 85 of file Telemetry.php.


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