Implement support for X-GitLab-Trace-Update-Interval header

gitlab#33658 (closed) describes a problem caused on GitLab.com infrastructure by Runner's trace patching mechanism.

gitlab#33658 (comment 237442464) contains the final proposal that we've decided to implement. This issue is created to track Runner's part of the implementation.

gitlab!20841 (merged) contains the GitLab part of the implementation.

What should be done

We should update the PATCH /jobs/:id/trace request handling:

  1. Normally it should behave like now, so the trace should be patched each 3 seconds (if there is any new job output of course).
  2. Each time when Runner receives the X-GitLab-Trace-Update-Interval header it updates the updateInterval to a value specified by GitLab.
Edited by Tomasz Maczukin