ProAndroidDev

The latest posts from Android Professionals and Google Developer Experts.

Follow publication

Understanding Talaiot

Talaiot is a simple Plugin written in Kotlin that helps to track the information of the Gradle tasks executed in your project during the build:

Motivation

Making a plugin to help to understand your builds is not a new idea. In the past we were using this awesome plugin by Pascal Hartig:

Thanks to this plugin we understood better these annoying tasks, consuming time and resources. Another cool Plugin is Kurinometer by Pedro Gómez:

It was developed with Scala and FP concepts.

However, we wanted to go further, for medium and big companies understanding the building process is critical to detect the bottlenecks and trying to keep the productivity and motivation of developers. Build Scan is excellent to understand all the details, and you can aggregate the results if you are using Gradle Enterprise.

But not all the companies are using Gradle Enterprise and is here where Talaiot could help teams of developers. Talaiot provides information about the build tasks and allows to extend and customize the information we want to analyze.

Internals of the Plugin

The base implementation is straight forward. We need to hook our tracker in the build process to collect information of the two main Gradle lifecycles involved:

— The task LifeCycle

— The build LifeCycle

The Talaiot Plugin provides one Listener that combine both interfaces information:

During the build, we will record information about the tasks like the length or status:

For instance, we found missing configurations on developer’s machines where tasks were not cached.

Finally, the information will be combined with two more components of the plugin:

— Metrics

— Publishers

Metrics

For every measurement done, Talaiot adds metrics to help you analyze data and detect problems due to different environments on the developer’s machines. Metrics are categorized by different configurations and can be disabled by groups. The Default Configuration of Metrics includes:

You can extend it with custom metrics. For instance, if we want to add the version of the app and a custom property we have to include the new metrics in the Talaiot configuration:

Publishers

Once the build is finished is the moment to publish the results. Talaiot includes two default publishers:

In the next post, we will explore more about InfluxDbPublisher. In case you have different systems or requirements Talaiot allows creating custom Publishers. You only have to extend the Publisherinterface:

And then include it in the Talaiot configuration in your Gradle file:

Final words

You can start using Talaiot today including the plugin in the classpath:

classpath("com.cdsap:talaiot:<latest_version>")

And applying the plugin:

plugins {
id("talaiot")
}

You will find more information about different configurations in the repository and wiki pages:

Don’t miss the next episode explaining the InfluxDbPublisher.

Thanks for reading and Happy Tracking!

Published in ProAndroidDev

The latest posts from Android Professionals and Google Developer Experts.

No responses yet

Write a response