Is there a way to find out which actions constitute a cache hit or miss?

68 Views Asked by At

I am trying to gain insights into which actions constitute a cache hit or miss during a bazel build. Not only that, but also whether they are "remote cache hit", "local", "remote" and so on. In the bazel event protocol (BEP), I can see a total summary of all actions in the section buildMetrics.runnerCount, e.g. (some dummy data below)

`"runnerCount":[
  {"name": "total", "count":263406},
  {"name": "remote cache hit", "count":158034},
  {"name": "internal", "count":104827},
  {"name": "local", "count":40},
  {"name": "remote", "count":2}
]`

however, I'd like to know exactly which actions constitute a remote cache hit or a local cache hit for example. The build event protocol doesn't seem to provide this information.

The execution log, instead, produced by using --execution_log_json_file reports for every action what is the 'runner', hence I can see exactly the info I need. The problem with that is that the execution log for big builds can amount to 100+ GB and makes build time very slow (whereas the very reason I want to find out about cache hits or misses is to speed up debugging and build time, so this seems counter-intuitive)

I know of tools such as BuildBuddy which provide information about cache hits or misses just using the build event stream. I am steering away from using these tools at the moment. Hence, I am assuming there must be a way to retrieve this information without having to use the execution log?

My questions are:

  1. Is it possible to retrieve whether each action constitutes a hit or miss and what is the spawn type using ONLY the build event protocol?
  2. If not, is the only alternative to get this information to use --execution_log_[binary/json]_file instead? How do tools such as buildBuddy retrieve this data then?
  3. If the execution log is the only way, is it possible to stream it in a similar way to how build events are streamed using bes_backend?
0

There are 0 best solutions below