Runner API endpoints should provide more context metadata

Background

The GitLab application Provides contextual metadata to structured logging. This is documented here: https://docs.gitlab.com/ee/development/logging.html#logging-context-metadata-through-workers

We include metadata such as root_namespace and project and username.

This is very useful in diagnostics, misused investigations and more.

Problem: runner endpoints provide minimal metadata

image

At present, the only identifying information logged for /api/:version/jobs/request or /api/:version/runners is an IP address.

This makes diagnosing problems such as #321827 (closed) much more difficult, as we're unable to correlate with potentially pathological data that a single client may have. Compare the diagnostics we were able to provide on that issue, vs. what we could provide for https://gitlab.com/gitlab-org/gitlab/-/issues/321788, a similar issue, with the appropriate metadata.

Solution: provide contextual metadata for runner queries

Offhand, this could be the project meta.project: "....." or group root_namespace: "..." that a runner is associated with, and potentially some sort of identifier for the runner.

Labelled as severity2 as it would help address #321827 (closed) which is severity2

cc @reprazent

Edited by Andrew Newdigate