gradle-doctor icon indicating copy to clipboard operation
gradle-doctor copied to clipboard

Display more information on negative avoidance message

Open NikolayMetchev opened this issue 3 years ago • 5 comments
trafficstars

It would be good when gradle doctor prints out which tasks took longer to be loaded from cache then a re-run would have taken for it to also print the time it thinks a re-run would have taken and how long loading from cache took. I looked in the build scan and for the tasks that gradle doctor is pointing out gradle enterprise does not agree that loading from cache took longer.

NikolayMetchev avatar Dec 20 '21 09:12 NikolayMetchev

Thanks for bringing this up @NikolayMetchev . The way the time difference is measured is different between the Gradle Doctor and Gradle Enterprise. Neither value is 100% accurate. Nor is it possible for either calculation to account for potential differences in the environment between the build pulling form the build cache and the build that populated the build cache.

If you are seeing a lot of false positives, you can adjust the value for negativeAvoidanceThreshold to be higher than the default of 500ms.

The value that Gradle Doctor uses to estimate this value is the Build Cache entry's originExecutionTime and it compares that to the loading task's duration. Gradle Enterprise uses a different calculation for this.

runningcode avatar Jan 11 '22 21:01 runningcode

Hi Nelson, In its current form the message is not very helpful and requires a lot of investigation in order to determine if it’s even worth doing something about it. If there are two calculations then maybe you can display both with caveats.

As it is now I am just ignoring those messages as noise. If I were to have more info easily accessible perhaps I can make a more informed decision about adjusting the gradle doctor settings or the task configuration.

NikolayMetchev avatar Jan 11 '22 21:01 NikolayMetchev

@runningcode Do you know how Gradle Enterprise compute this? I am also seeing warnings from this plugin that don't seem to hold true compared to what I see in the Gradle enterprise UI. It would be great if the plugin would show at least the delta, or how long it took for the original task to compute without the cache

hverlin avatar Dec 01 '22 17:12 hverlin

It appears that it should be possible to add the delta here, as well as the original build ID?

  • https://github.com/runningcode/gradle-doctor/blob/93476dbd4032358b55c60e93655dbd57f91ec3e5/doctor-plugin/src/main/java/com/osacky/doctor/SlowerFromCacheCollector.kt#L25
  • https://github.com/gradle/gradle/blob/a639c1e0507832980230e288b000913d716c463c/subprojects/core/src/main/java/org/gradle/api/internal/tasks/execution/ExecuteTaskBuildOperationResult.java#L71

Would you accept a PR for this if this is possible?

hverlin avatar Dec 01 '22 17:12 hverlin

Something I have noticed is that probably Gradle enterprise ignore the fingerprinting inputs` duration, whereas Gradle doctor considers it?

hverlin avatar Dec 02 '22 13:12 hverlin