MediaWiki master
|
Service for handling telemetry data. More...
Inherits Wikimedia\Http\TelemetryHeadersInterface.
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 () |
Service for handling telemetry data.
Definition at line 29 of file Telemetry.php.
MediaWiki\Http\Telemetry::__construct | ( | array | $server, |
?bool | $allowExternalReqID = null ) |
array | $server | Server and execution environment information, most likely the $_SERVER variable |
Definition at line 55 of file Telemetry.php.
|
static |
Definition at line 60 of file Telemetry.php.
References $wgAllowExternalReqID.
Referenced by MediaWiki\Logger\Monolog\WikiProcessor\__invoke(), and MediaWiki\Http\HttpRequestFactory\createMultiClient().
MediaWiki\Http\Telemetry::getRequestHeaders | ( | ) |
Return Telemetry data in form of request headers.
Implements Wikimedia\Http\TelemetryHeadersInterface.
Definition at line 135 of file Telemetry.php.
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 77 of file Telemetry.php.
References wfRandomString().
MediaWiki\Http\Telemetry::getTraceparent | ( | ) |
Get the OpenTelemetry traceparent info, Returns null when not present or AllowExternalReqID is set to false.
Definition at line 127 of file Telemetry.php.
MediaWiki\Http\Telemetry::getTracestate | ( | ) |
Get the OpenTelemetry tracestate info Returns null when not present or AllowExternalReqID is set to false.
Definition at line 117 of file Telemetry.php.
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.
string | $newId |
Definition at line 98 of file Telemetry.php.
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.
Definition at line 107 of file Telemetry.php.