Use contextvars to populate invocation_metadata in remote CAS/ActionCache requests
Before raising this MR, consider whether the following are required, and complete if so:
-
Unit tests -
Metrics -
Documentation update(s)
Documentation is not required to be updated, and metrics to collect statistics are available after deployment.
Description
This request makes use of the a new context module (that makes use of contextvars
) to set metadata for requests made when using the remote CAS/Action Cache, and populated by the invocation_metadata()
of context
. It is hoped that adding this additional information will make it easier to trace where requests are coming from ,when looking at the logs.
Changes proposed in this merge request:
- The creation of a new context module to define the ContextVar variable used for the remote CAS/Action Cache requests, as well as a decorator and a couple of helper functions. One to generate a default RequestMetadata() for the ContextVar and the other to create a metadata list used in the requests.
- Decorator will populate ContextVar variables with metadata obtained from
context
and reset variable when method completes - Adding metadata to requests for remote CAS/Action Cache
Validation
- Create a buildgrid with a remote CAS and Action Cache
- Run servers locally from command line
- Change recc configuration variables to match buildgrid configuration
- Use recc (for example, recc /usr/bin/gcc -c hello.c -o hello.o)
- Check output logs for correct metadata set in CAS and Action Cache
Issues addressed
Addresses the issue of not having the request metadata available in the logs of a remote CAS/Action Cache, which allows for easier debugging.
Edited by Neill Whillans