From 2c5ec5a29a67e1e090a87722c4cdcb46b5d63594 Mon Sep 17 00:00:00 2001 From: Wojtek Zieba Date: Fri, 29 Mar 2024 10:58:44 +0100 Subject: [PATCH] docs: update README --- README.md | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7ac98fb..d3219d0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ # measure-builds Gradle Plugin [![Pre Merge Checks](https://github.com/cortinico/kotlin-gradle-plugin-template/workflows/Pre%20Merge%20Checks/badge.svg)](https://github.com/cortinico/kotlin-gradle-plugin-template/actions?query=workflow%3A%22Pre+Merge+Checks%22) -Gradle Plugin for reporting build metrics into internal Automattic systems. +Gradle Plugin for reporting build metrics at the end of the build. + +## Features +- Add own, custom reporters and send metrics to any system +- Configuration Cache compatibility +- Gradle Enterprise integration - optionally attach Gradle Scan Id to the metrics ## Setup @@ -11,24 +16,34 @@ plugins { } // build.gradle +import com.automattic.android.measure.reporters.MetricsReport +import com.automattic.android.measure.reporters.SlowSlowTasksMetricsReporter + plugins { id "com.automattic.android.measure-builds" version "latest_tag" } measureBuilds { - automatticProject.set(com.automattic.android.measure.MeasureBuildsExtension.AutomatticProject.WooCommerce) - attachGradleScanId.set(true) // `false`, if no Enterprise plugin applied OR don't want to attach build scan id + enable = true + attachGradleScanId = true // `false`, if no Enterprise plugin applied OR don't want to attach build scan id + onBuildMetricsReadyListener { MetricsReport metricsReport -> + // Use ready reporters + SlowSlowTasksMetricsReporter.report(metricsReport) + + // or add your own reporters here or use + MyCustomReporter.report(metricsReport) + } } ``` ## Configuration -| Property | Required? | Description | -|--------------------|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| automatticProject | yes | Project that will determine event name | -| attachGradleScanId | yes | Upload metrics after build scan is published, with build scan id attached. If `false`, metrics will be uploaded upon build finish, without build scan id attached | -| enable | no | Enable plugin (def: `false`) | -| obfuscateUsername | no | Obfuscate system username with SHA-1 (def: `false`) | +| Property | Default | Description | +|-----------------------------|----|-------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| enable | `false` | Enable plugin | +| onBuildMetricsReadyListener | | Callback to be called when build metrics are ready to be reported. Use this to add your own reporters. | +| attachGradleScanId | `false` | Upload metrics after build scan is published, with build scan id attached. If `false`, metrics will be uploaded upon build finish, without build scan id attached | +| obfuscateUsername | `false` | Obfuscate system username with SHA-1 | ## Demo