Page MenuHomePhabricator

Add client-side logging for non-MediaWiki action API errors (HTTP 429)
Closed, ResolvedPublic

Description

When a MediaWiki action API request fails because of an error on the MediaWiki side, we have PHP error logging that allows people to be alerted and debug the error. When it fails for some other reason, the situation is more murky.

In particular, in order to be able to know whether normal users of web browsers are affected by the new API rate limits (as opposed to the scrapers that the limits are intended for), and to have some idea about which components are making too many API requests, we should log it on the client side when an action API request fails with a HTTP 429 error.

Related Objects

Event Timeline

Change #1247702 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] mw.Api: Client-side logging for HTTP 429 errors

https://gerrit.wikimedia.org/r/1247702

@daniel pointed out that the error logging endpoint needs to be exempt from rate limits for this to work.

Change #1253626 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[operations/mediawiki-config@master] Configure $wgApiClientErrorSampleRate

https://gerrit.wikimedia.org/r/1253626

Change #1253626 merged by jenkins-bot:

[operations/mediawiki-config@master] Configure $wgApiClientErrorSampleRate

https://gerrit.wikimedia.org/r/1253626

Mentioned in SAL (#wikimedia-operations) [2026-03-16T20:57:26Z] <catrope@deploy2002> Started scap sync-world: Backport for [[gerrit:1253623|Fix client credentials access tokens (T417278 T419921)]], [[gerrit:1253625|Enable $wgTrackMediaRequestProvenance on testwikis and beta cluster (T414338)]], [[gerrit:1253626|Configure $wgApiClientErrorSampleRate (T418957)]]

Mentioned in SAL (#wikimedia-operations) [2026-03-16T20:59:17Z] <catrope@deploy2002> matmarex, catrope: Backport for [[gerrit:1253623|Fix client credentials access tokens (T417278 T419921)]], [[gerrit:1253625|Enable $wgTrackMediaRequestProvenance on testwikis and beta cluster (T414338)]], [[gerrit:1253626|Configure $wgApiClientErrorSampleRate (T418957)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-03-16T21:05:37Z] <catrope@deploy2002> Finished scap sync-world: Backport for [[gerrit:1253623|Fix client credentials access tokens (T417278 T419921)]], [[gerrit:1253625|Enable $wgTrackMediaRequestProvenance on testwikis and beta cluster (T414338)]], [[gerrit:1253626|Configure $wgApiClientErrorSampleRate (T418957)]] (duration: 08m 06s)

Change #1247702 merged by jenkins-bot:

[mediawiki/core@master] mw.Api: Client-side logging for HTTP 429 errors

https://gerrit.wikimedia.org/r/1247702

@daniel pointed out that the error logging endpoint needs to be exempt from rate limits for this to work.

Turns out the event logging endpoint is not behind the api gateway, so this point is moot.

patch merged, will ride the train next week