From 1981e704c7b046f226088e0619affbe5f9dd2610 Mon Sep 17 00:00:00 2001 From: Piotr Miazga Date: Wed, 9 Aug 2023 17:19:42 +0200 Subject: 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 --- includes/http/Telemetry.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'includes/http') 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 @@ -97,6 +97,15 @@ class Telemetry { $this->reqId = $newId; } + /** + * 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 -- cgit v1.2.3