aboutsummaryrefslogtreecommitdiffstats
path: root/includes/http
diff options
context:
space:
mode:
authorPiotr Miazga <pmiazga@wikimedia.org>2023-08-09 17:19:42 +0200
committerPiotr Miazga <pmiazga@wikimedia.org>2023-08-09 18:13:58 +0200
commit1981e704c7b046f226088e0619affbe5f9dd2610 (patch)
treeb626fedd16c4b39996158c75f77b9cdafe2f42dc /includes/http
parent5e6d955c224025c2c565136b13f0807c91d0a674 (diff)
downloadmediawikicore-1981e704c7b046f226088e0619affbe5f9dd2610.tar.gz
mediawikicore-1981e704c7b046f226088e0619affbe5f9dd2610.zip
http: fix JobRunner overriding requestId with null
After deploying T320559 we found out that JobRunner sometimes calls the WebRequest::overrideRequestId() with a null. This caused the TelemetryService to fail due to $newId not being a string. As a solution there is a new method called regenerateRequestId() that will handle the regeneration as it's recommended to keep the overrideRequestId() strict. Bug: T343893 Change-Id: I3e6daa238fd8de0d9ea88660b8ba32b922b1323d
Diffstat (limited to 'includes/http')
-rw-r--r--includes/http/Telemetry.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/includes/http/Telemetry.php b/includes/http/Telemetry.php
index 07406e92ce8a..6382dabc4d25 100644
--- a/includes/http/Telemetry.php
+++ b/includes/http/Telemetry.php
@@ -98,6 +98,15 @@ class Telemetry {
}
/**
+ * 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.
+ * @return void
+ */
+ public function regenerateRequestId() {
+ $this->reqId = null;
+ }
+
+ /**
* Get the OpenTelemetry tracestate info
* Returns null when not present or AllowExternalReqID is set to false
*