Right, because cache requests don’t include the task name. When Gradle asks the build cache for a task’s output the request is simply the key itself, no information about the task is in the GET
request.
That said, the cached task outputs do contain a metadata file with origin task information, but this won’t help you in the case of cache misses, because in that scenario there is no cache artifact on the server, hence the miss.
It’s totally fine for me to collect this information in the runtime environment.
Build scans already collect this information so you might look into using Gradle Enterprise for this purpose.