jobqueue: Add job_type to PSR logging context
authorAntoine Musso <hashar@free.fr>
Fri, 30 Sep 2016 21:34:33 +0000 (23:34 +0200)
committerKrinkle <krinklemail@gmail.com>
Tue, 8 Aug 2017 05:00:52 +0000 (05:00 +0000)
commit40a9ad6ea1cd300075eecf43e70cc8ade8828919
treef012a46bf62fb3dabc36696f2797c9e1942503db
parentb8a7d492ebf6dc199efedb110785cef3a89ef850
jobqueue: Add job_type to PSR logging context

The mediawiki.runJobs errors are collected in Logstash but the whole job
description and errors are a single field message. That is challenging
to split logs per job type, get the longest running jobs ...

That can be worked around on the log receiving side by parsing
MediaWiki messages eg https://gerrit.wikimedia.org/r/#/c/312504/

Bryan Davis suggested a better long term solution is to use the PSR3
logger with structured log messages.

Culprit: 'type' is a reverved word. Hence prefix all context variables
with 'job_'.

Bug: T146469
Change-Id: Ib6a771c7d3f83bd75b2994bfab9bbebfd1f5aa6c
includes/jobqueue/JobRunner.php