GithubHelp home page GithubHelp logo

asarkar / build-time-tracker Goto Github PK

View Code? Open in Web Editor NEW
75.0 75.0 9.0 173 KB

Gradle plugin that prints the time taken by the tasks in a build

License: Apache License 2.0

Kotlin 100.00%
build gradle-plugin metrics performance tracker

build-time-tracker's People

Contributors

asarkar avatar liying2010 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

build-time-tracker's Issues

Intellij missing bar character

Intellij gradle build shows ? chars instead of bars.

 :backend:commons:compileJava | 2S | 12% | ??
  :backend:server:flywayClean | 4S | 24% | ????
:backend:server:flywayMigrate | 5S | 29% | ?????
  :backend:server:compileJava | 1S |  6% | ?
              :web:npmInstall | 1S |  6% | ?

Still informative, but looks bad.

Incorrect execution times for tasks for tasks running in parralel

Hi.

It looks like this plugin measures times between moments of time when task executions end. Not real time it takes to run a task. There is no difference if all tasks are executed one after another, but there is difference if tasks are executed in parallel.

For example, let's say we have tasks A and B. They are executed in parallel. Task A takes 9 seconds to finish, task B takes 10 seconds to finish. Total build time will be 10S for the whole build. Then this plugin will show.

A | 9S | 
B | 1S | 

Expected.

A | 9S  | 
B | 10S | 

This issue makes build time measurements for individual tasks almost unusable in heavily modularized projects where lot of tasks are executed in parallel.

Provide option to suppress output

Read first

  1. Do not open issues for questions, use https://github.com/asarkar/build-time-tracker/discussions instead.
  2. Have you searched in issues and discussions for a similar problem?

Is your feature request related to a problem? Please describe
Description of what the problem is.

Hey, i want to have this feature disabled as default, and only show in CI/if user adds a parameter.
I haven't seen this option.
i think will be helpful.

Describe the solution you'd like
Description of what you want to happen.

add configuration for enable (true/false).

Describe alternatives you've considered
Description of any alternative solutions or features you've considered.

Environment

  • build-time-tracker plugin version: 4.0.3
  • OS: linux
  • Gradle version: 7.2
  • JDK version: 17

Additional context
Add any other context or screenshots about the feature request here.

Distributed tracking of build time

Hey there! I was searching to build something similar until I came across your project. The main reason I'd looking to build would be to allow tracking the build time from from the developers machine. So let's say you have multiple squads working on the same project; each squad with multiple developers; so build time may becomes critical at some point.

I was thinking if it would make sense to upload those generated CSV files to some sort of remote storage like S3 (extensible to other providers). Plus adding a few extra properties in the CSV in order to be possible to know the machine configuration or maybe some way that consumers of the plugin can dynamically add columns they would like to have on top of the base columns.

Would you be considering such a thing and willing to take PRs towards that ?

Sort tasks in the output from lowest build time to highest

Instead of sorting like this

:task1 | 27S | 30% | ███████████████████████████
:task2 | 17S | 19% | █████████████████
:task3 | 13S | 14% | █████████████
:task4 | 12S | 13% | ████████████

please let it be sorted like this by default.

:task4 | 12S | 13% | ████████████
:task3 | 13S | 14% | █████████████
:task2 | 17S | 19% | █████████████████
:task1 | 27S | 30% | ███████████████████████████

Or may be let it be an option.

The reason is that the tasks with the longest build times are the most interesting for us. By seeing which tasks run the longest we can detect potential build time issues. Or we can get insights about what should we focus on when optimizing build times.

Right now build times for the tasks with the longest build times are printed on the top of the output. Then there is a long tail of tasks with short build times. So in order for us to look at the most interesting tasks we need to scroll script output up. Which is very inconvenient and we may lose some insights because we won't do that scrolling after each build.

Standardize durations

The output task durations are in seconds, which isn't very convenient. If a task runs for 3 minutes, it'll show up as 180.000s, instead of the more human-friendly 3M. Same argument applies to the minTaskDuration configuration option. Both should be standardized.
This will be a breaking change.

Support for output to CSV file

Hi there! Thanks for supporting this library. I've been using the original version from passy as I need to document how bad our build times are and demonstrate with data, how much of an improvement on average each effort to reduce them achieves.

The original library supports writing to .csv files which I've been using, do you plan to provide support for anything similar? I don't see any documentation so I'm not sure it's supported here.

Plugin customizations are ignored if configuration cache is enabled

Describe the bug

Build times are not sorted if build configuration is restored from Gradle configuration cache.

When configuration phase is properly executed (configuration is not restored from the cache) then everything is sorted as expected.

To Reproduce

Use sortBy = com.asarkar.gradle.buildtimetracker.Sort.ASC
Gradle has configuration cache enabled.
Make sure build configuration is restored from the Gradle configuration cache. By executing the build second time without changing gradle files for example.

Expected behavior

Build times are sorted.

Environment

  • build-time-tracker plugin version: 4.2.0
  • OS: Mac OS
  • Gradle version: 7.2
  • JDK version: 11

Fix console formatting

:service-client:compileKotlin | 1.432s |  8% | █
                  webapp:test | 13.882s | 76% | ██████████████

Fix misaligned durations.

sum does not add up to 100%

Hey, I ran this plugin in our project and the total sum of the percentages in the time is not 100%, in my case it was 206%.
Is it expected ?

NoClassDefFoundError: kotlin/time/TimeSource$Monotonic

org.gradle.internal.event.ListenerNotificationException: Failed to notify build listener.
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:86)
...

Caused by: java.lang.NoClassDefFoundError: kotlin/time/TimeSource$Monotonic

Support Java 8

Looks like this plugin requires Java 11 or later,
but why?
can you provide Java8 Supporting, so we can use this plugin in our Java8 environment

Thanks~~~

Support Gradle Configuration Cache

The plugin cannot be used in a project that also uses the new configuration cache (https://docs.gradle.org/7.2/userguide/configuration_cache.html)

When trying to enable the config cache there is a build failure and this message:

FAILURE: Build failed with an exception.

* What went wrong:
Configuration cache problems found in this build.

...
- Plugin 'com.asarkar.gradle.build-time-tracker': registration of listener on 'Gradle.addListener' is unsupported
  See https://docs.gradle.org/7.2/userguide/configuration_cache.html#config_cache:requirements:build_listeners

Fail the build if it took too long?

My team has some modules that take quite a long time to build. I'd like to enforce a 10 minute build requirement such that builds will fail if they take too long. This plugin seems well-suited to the task; you could just add an optional flag that fails the build if it's above the configured threshold. Default behaviour could continue to be succeeding with info.

My alternative, after some Googling, seems to be to create a build-time-requirement plugin from scratch. It would be a shame though since this plugin already does 90% of what we need.

Let me know your thoughts. Also happy to take a stab at writing the code for this if you'd consider including the feature.

Thanks!

Explain why nothing is printed

When all the tasks timings are below the threshold, nothing is printed on the output, which may be confusing to the user. Output a log statement to make it clear when this happens.

Compilation failure on Java 8

> Task :compileKotlin FAILED
e: /Volumes/Workspace/build-time-tracker/src/main/kotlin/org/asarkar/gradle/TimingRecorder.kt: (26, 69): Cannot access 'toSeconds': it is private in 'Duration'
e: /Volumes/Workspace/build-time-tracker/src/main/kotlin/org/asarkar/gradle/TimingRecorder.kt: (27, 25): Type mismatch: inferred type is Long but BigDecimal! was expected
e: /Volumes/Workspace/build-time-tracker/src/main/kotlin/org/asarkar/gradle/TimingRecorder.kt: (28, 31): Type inference failed. Expected type mismatch: inferred type is Pair<String, BigDecimal!> but Pair<String, Long> was expected
e: /Volumes/Workspace/build-time-tracker/src/main/kotlin/org/asarkar/gradle/TimingRecorder.kt: (39, 41): Cannot access 'toSeconds': it is private in 'Duration'
e: /Volumes/Workspace/build-time-tracker/src/main/kotlin/org/asarkar/gradle/TimingRecorder.kt: (43, 75): Cannot access 'toSeconds': it is private in 'Duration'
e: /Volumes/Workspace/build-time-tracker/src/main/kotlin/org/asarkar/gradle/TimingRecorder.kt: (48, 37): Type mismatch: inferred type is BigDecimal! but Long was expected

> Task :compileTestKotlin FAILED
e: /Volumes/Workspace/build-time-tracker/src/test/kotlin/org/asarkar/gradle/BuildTimeTrackerPluginFunctionalTest.kt: (67, 23): Unresolved reference: readString

The this SO question; Duration.toSeconds is basically the same as Duration.getSeconds and was added in Java 9 to avoid confusion.
Files.readString came in Java 11.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.