HeaderCallback: Remove pre-caching of WebRequest::getRequestId

This effectively reverts ef26a5b07b (I245747d0b6fcdf0f6), which
added the pre-caching to implicity autoload additional classes used by
getRequestId(), per https://phabricator.wikimedia.org/T261260#6630577.

This has since been fixed by 5ab13a054 (Ia542ac7aab7b), which
simplified WebRequest::getRequestId to no longer involve other classes.

The impact of ef26a5b07b was that `$wgAllowExternalReqID` no
longer worked in production, because HeaderCallback is, and has to,
be called in Setup.php prior to loading LocalSettings.php, thus it
couldn't be set in time. This meant the `reqId` logged from MW went
back to the value of UNIQUE_ID or wfRandomString, not X-Request-Id.

Side effects:

* WikimediaDebug can't find XHGui profiles because
  wmf-config/profiler.php sees `X-Request-Id`, whereas the JS code
  that exported the value of `getRequestId` does not, thus they have
  different IDs.

* Logstash search for a reqId no longer find messages correlating
  with php-wmerrors (puppet php7-fatal-erorr.php), same issue as
  XHGui.

* Logstash results from Varnish, ATS, or Apache don't correlate with
  MW log messages, etc.

Bug: T273256
Change-Id: I3d5f440591c83d7f8c133e3e3a544175313bbd6b
This commit is contained in:
Timo Tijhof 2021-03-09 20:30:24 +00:00 committed by Krinkle
parent cf852a69e3
commit 5c860e462e

View file

@ -23,8 +23,6 @@ class HeaderCallback {
// it will have to be loaded at some point anyway.
// This can be removed once we require PHP 8.0+.
class_exists( \WebRequest::class );
// Likewise, cache the request ID.
\WebRequest::getRequestId();
header_register_callback( [ __CLASS__, 'callback' ] );
}