To minimize the traffic sent to the stats endpoint we should track MinervaClientError counter only once after the request is done, not on every error occurrence.
Additionally tracking once per request should allow us to find out what is the average errors count per page view (is it just one error from time to tome, or is it multiple errors at the same page view)
Acceptance criteria
- Rather than adding 1 to counter.MediaWiki.minerva.WebClientError we will use an unload event to add all errors in one go.
Developer notes
Piotr's patch does the job but was reverted so we can take time to talk through the details in grooming and Sam's comment below (T212970#4943448). It can be be reapplied and +2ed when that's happened and we've given it the OK.