### Example Output Log Source: https://github.com/cdsap/talaiot/wiki/Publishers Sample output format generated by the Talaiot execution publisher. ```text :consumer-server:domain-server:clean : 1 ms :consumer-server:repository-server:clean : 1 ms :consumer-server:server:clean : 2 ms :core-network:clean : 3 ms :core-domain:clean : 7 ms ¯\ :consumer-android:repository-android:clean : 39 ms ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ :consumer-android:app:clean : 832 ms ``` -------------------------------- ### Complete Talaiot Configuration Example Source: https://context7.com/cdsap/talaiot/llms.txt Configure multiple publishers, metrics, and filters for detailed build performance tracking. Includes settings for logging, ignoring local builds, and specific publisher configurations like JSON, timeline, InfluxDB, and Elasticsearch. ```kotlin plugins { id("io.github.cdsap.talaiot") version "2.1.1" } talaiot { // Enable detailed logging logger = io.github.cdsap.talaiot.logger.LogTracker.Mode.INFO // Skip on local development ignoreWhen { envName = "LOCAL_DEV" envValue = "true" } publishers { // Local JSON output for CI artifacts jsonPublisher = true // Timeline for debugging parallel execution timelinePublisher = true // InfluxDB for time-series dashboards influxDbPublisher { dbName = "gradle_metrics" url = "http://influxdb.internal:8086" username = System.getenv("INFLUXDB_USER") ?: "" password = System.getenv("INFLUXDB_PASS") ?: "" taskMetricName = "gradle_task" buildMetricName = "gradle_build" retentionPolicyConfiguration { name = "builds_30d" duration = "30d" } } // Elasticsearch for log aggregation elasticSearchPublisher { url = "http://elasticsearch.internal:9200" taskIndexName = "gradle-tasks" buildIndexName = "gradle-builds" } } metrics { // Disable verbose metrics for cleaner data processMetrics = false // Add project-specific metrics customBuildMetrics( "appVersion" to project.version.toString(), "minSdk" to "24", "targetSdk" to "34", "buildFlavor" to (project.findProperty("flavor") ?: "debug") ) } filter { // Only report meaningful tasks threshold { minExecutionTime = 50 // Ignore tasks under 50ms } // Exclude test and lint tasks from metrics tasks { excludes = arrayOf("test.*", "lint.*", "ktlint.*") } // Only publish successful release builds build { success = true requestedTasks { includes = arrayOf(".*assemble.*Release.*", ".*bundle.*Release.*") } } } } ``` -------------------------------- ### Docker Quick Start for Talaiot Dashboard Source: https://context7.com/cdsap/talaiot/llms.txt Run a pre-configured Docker image with InfluxDB and Grafana to visualize Talaiot metrics. Access Grafana at http://localhost:3003 with default credentials root/root. ```bash # Start InfluxDB + Grafana container with pre-configured dashboards docker run -d \ --name talaiot-dashboard \ -p 3003:3003 \ -p 8086:8086 \ -v influxdb-data:/var/lib/influxdb \ -v grafana-data:/var/lib/grafana \ cdsap/talaiot:latest # Access Grafana at http://localhost:3003 # Default credentials: root/root # Configure your project to send metrics # build.gradle.kts talaiot { publishers { influxDbPublisher { dbName = "tracking" url = "http://localhost:8086" taskMetricName = "task" buildMetricName = "build" } } } # Run builds to populate data ./gradlew assembleDebug ./gradlew clean assembleRelease ``` -------------------------------- ### Run Talaiot Docker Container Source: https://github.com/cdsap/talaiot/blob/master/README.md Starts a Docker container pre-configured with InfluxDb and Grafana for monitoring. ```bash docker run -d \ -p 3003:3003 \ -p 3004:8083 \ -p 8086:8086 \ -p 22022:22 \ -v /var/lib/influxdb \ -v /var/lib/grafana \ cdsap/talaiot:latest ``` -------------------------------- ### Configure HybridPublisher with ElasticSearch and InfluxDb Source: https://github.com/cdsap/talaiot/wiki/Publishers Utilize the HybridPublisher to combine different publishers for task and build metrics. This example configures ElasticSearch for task metrics and InfluxDb for build metrics. ```kotlin publishers { hybridPublisher { taskPublisher = ElasticSearchPublisherConfiguration().apply { url = "http://localhost:9200" buildIndexName = "build" taskIndexName = "task" } buildPublisher = InfluxDbPublisherConfiguration().apply { dbName = "tracking" url = "http://localhost:8086" buildMetricName = "build" taskMetricName = "task" } } } ``` -------------------------------- ### Run Sample Gradle Project Source: https://github.com/cdsap/talaiot/blob/master/README.md Executes the assemble task for the sample project included in the repository. ```bash cd sample ./gradlew assemble ``` -------------------------------- ### Configure Output Publisher Source: https://context7.com/cdsap/talaiot/llms.txt Enable the output publisher to print task execution times to the console, sorted by duration. This publisher requires no additional configuration. ```kotlin // build.gradle.kts talaiot { publishers { outputPublisher { // No additional configuration required } } } // Console output example: // :app:clean : 1 ms // :core:clean : 2 ms // :feature:compileKotlin : 832 ms // ¯\_(ツ)_/¯ :app:assembleDebug : 15432 ms ``` -------------------------------- ### Configure Snapshot Repositories and Dependencies Source: https://github.com/cdsap/talaiot/blob/master/README.md Add the Sonatype snapshot repository and define snapshot dependencies for standard or individual plugins. ```kotlin maven ( url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") ) ``` ```kotlin classpath("io.github.cdsap:talaiot:-SNAPSHOT") ``` ```kotlin classpath("io.github.cdsap.talaiot.plugin:base:-SNAPSHOT") ``` -------------------------------- ### Configure RethinkDB Publisher Source: https://context7.com/cdsap/talaiot/llms.txt Configure the RethinkDB publisher to store build metrics in a real-time database. Requires database name, URL, task table name, and build table name. Optional authentication can be provided. ```kotlin // build.gradle.kts talaiot { publishers { rethinkDbPublisher { // Required configuration dbName = "tracking" url = "localhost:28015" // Table names for tasks and builds taskTableName = "tasks" buildTableName = "builds" // Optional authentication username = "admin" password = "secret" // Control what gets published publishBuildMetrics = true publishTaskMetrics = true } } } ``` -------------------------------- ### Configure InfluxDB 2.x Publisher Source: https://context7.com/cdsap/talaiot/llms.txt Set up the InfluxDB 2.x publisher using token-based authentication and bucket configuration. ```kotlin // build.gradle.kts talaiot { publishers { influxDb2Publisher { // Required configuration url = "http://localhost:8086" token = System.getenv("INFLUXDB_TOKEN") org = "my-organization" bucket = "gradle-builds" // Metric names taskMetricName = "task" buildMetricName = "build" // Control what gets published publishBuildMetrics = true publishTaskMetrics = true // Specify which metrics should be tags buildTags = listOf( io.github.cdsap.talaiot.metrics.BuildMetrics.RootProject ) } } } ``` -------------------------------- ### Implement a custom Publisher Source: https://context7.com/cdsap/talaiot/llms.txt Implement the Publisher interface to create custom logic for processing build metrics, such as sending notifications to Slack. ```kotlin // build.gradle.kts import io.github.cdsap.talaiot.publisher.Publisher import io.github.cdsap.talaiot.entities.ExecutionReport import io.github.cdsap.talaiot.entities.TaskMessageState class SlackNotificationPublisher( private val webhookUrl: String, private val channel: String ) : Publisher { override fun publish(report: ExecutionReport) { val duration = report.durationMs?.toLongOrNull() ?: 0 val taskCount = report.tasks?.size ?: 0 val cacheHits = report.tasks?.count { it.state == TaskMessageState.FROM_CACHE } ?: 0 val cacheRatio = if (taskCount > 0) (cacheHits * 100 / taskCount) else 0 val message = buildString { append("*Build ${if (report.success) "Succeeded" else "Failed"}*\n") append("Project: ${report.rootProject}\n") append("Tasks: ${report.requestedTasks}\n") append("Duration: ${duration / 1000}s\n") append("Cache hit ratio: $cacheRatio%\n") append("Total tasks: $taskCount") } // Send to Slack webhook java.net.URL(webhookUrl).openConnection().apply { doOutput = true setRequestProperty("Content-Type", "application/json") outputStream.write("""{"channel":"$channel","text":"$message"}""".toByteArray()) } } } // Use custom publisher talaiot { publishers { customPublishers( SlackNotificationPublisher( webhookUrl = System.getenv("SLACK_WEBHOOK_URL"), channel = "#build-notifications" ) ) } } ``` -------------------------------- ### Configure Task and Build Filters Source: https://context7.com/cdsap/talaiot/llms.txt Define inclusion and exclusion rules for tasks, modules, and build success criteria. ```kotlin // build.gradle.kts talaiot { filter { // Filter tasks by name (regex patterns) tasks { includes = arrayOf("assemble.*", "compile.*") excludes = arrayOf("clean", "preBuild") } // Filter tasks by module (regex patterns) modules { includes = arrayOf(":app", ":feature.*") excludes = arrayOf(":test.*", ":benchmark") } // Filter tasks by execution time (milliseconds) threshold { minExecutionTime = 100 // Only report tasks taking > 100ms maxExecutionTime = 60000 // Exclude tasks taking > 60s } // Filter entire builds build { // Only publish successful builds success = true // Filter by requested tasks requestedTasks { includes = arrayOf(":app:assemble.*") excludes = arrayOf(":app:test.*", ":app:lint.*") } } } } ``` -------------------------------- ### Enable JSON Publisher Source: https://context7.com/cdsap/talaiot/llms.txt Enable the JSON publisher to output build metrics to a local JSON file for offline analysis or CI artifact storage. No specific configuration parameters are needed beyond enabling the publisher. ```kotlin // build.gradle.kts talaiot { publishers { // Simple boolean to enable jsonPublisher = true } } // Output file location: build/reports/talaiot/talaiot.json // Example output: // { // "beginMs": "1609459200000", // "endMs": "1609459230000", // "durationMs": "30000", // "configurationDurationMs": "5000", // "success": true, // "rootProject": "my-app", // "requestedTasks": "assembleDebug", // "tasks": [ // {"taskName": "compileKotlin", "ms": 15000, "state": "EXECUTED"}, // {"taskName": "compileJava", "ms": 5000, "state": "FROM_CACHE"} // ] // } ``` -------------------------------- ### Configure Prometheus PushGateway Publisher Source: https://context7.com/cdsap/talaiot/llms.txt Configure the Prometheus PushGateway publisher to export metrics for Prometheus scraping. Requires URL, task job name, and build job name. ```kotlin // build.gradle.kts talaiot { publishers { pushGatewayPublisher { // Required configuration url = "http://localhost:9091" // Job names for Prometheus metrics taskJobName = "gradle_task" buildJobName = "gradle_build" // Control what gets published publishBuildMetrics = true publishTaskMetrics = true } } } ``` -------------------------------- ### Configure InfluxDB 1.x Publisher Source: https://context7.com/cdsap/talaiot/llms.txt Set up the InfluxDB 1.x publisher with custom retention policies and build tags. ```kotlin // build.gradle.kts talaiot { publishers { influxDbPublisher { // Required configuration dbName = "tracking" url = "http://localhost:8086" // Metric names in InfluxDB taskMetricName = "task" buildMetricName = "build" // Optional authentication username = "admin" password = "secret" // Control what gets published publishBuildMetrics = true publishTaskMetrics = true // Custom retention policy retentionPolicyConfiguration { name = "rpTalaiot" duration = "30d" shardDuration = "30m" replicationFactor = 2 isDefault = false } // Specify which metrics should be tags (for filtering/grouping) buildTags = listOf( io.github.cdsap.talaiot.metrics.BuildMetrics.RootProject, io.github.cdsap.talaiot.metrics.BuildMetrics.RequestedTasks ) } } } ``` -------------------------------- ### Configure TimelinePublisher in Talaiot Source: https://github.com/cdsap/talaiot/wiki/Publishers Enable the TimelinePublisher to generate a PNG image visualizing task execution chronologically across workers. This is configured with a simple boolean flag. ```kotlin publishers { timelinePublisher = true } ``` -------------------------------- ### Define Experimental Provider Metrics Source: https://github.com/cdsap/talaiot/blob/master/README.md Use initialProviderMetrics and finalProviderMetrics for lazy evaluation compatible with Configuration Cache. Requires opting in to ExperimentalMetricsApi. ```kotlin metrics { initialProviderMetrics( "init_memory_metric" to providers.of(GetMemory::class) {} ) finalProviderMetrics( "end_memory_metric" to providers.of(GetMemory::class) {} ) } ``` -------------------------------- ### Configure Hybrid Publisher Source: https://context7.com/cdsap/talaiot/llms.txt Use the hybrid publisher to send task metrics to one backend and build metrics to another. Requires configuration for both task and build publishers, specifying their respective endpoints and settings. ```kotlin // build.gradle.kts import io.github.cdsap.talaiot.publisher.elasticsearch.ElasticSearchPublisherConfiguration import io.github.cdsap.talaiot.publisher.influxdb.InfluxDbPublisherConfiguration talaiot { publishers { hybridPublisher { // Send task metrics to Elasticsearch taskPublisher = ElasticSearchPublisherConfiguration().apply { url = "http://localhost:9200" taskIndexName = "gradle-tasks" buildIndexName = "gradle-builds" } // Send build metrics to InfluxDB buildPublisher = InfluxDbPublisherConfiguration().apply { dbName = "tracking" url = "http://localhost:8086" buildMetricName = "build" taskMetricName = "task" } } } } ``` -------------------------------- ### Configure Individual Plugins with Kotlin DSL Source: https://github.com/cdsap/talaiot/blob/master/README.md Apply specific Talaiot plugins like the base plugin using Kotlin DSL. ```kotlin plugins { id("io.github.cdsap.talaiot.plugin.base") version "" } ``` ```kotlin buildscript { repositories { gradlePluginPortal() } dependencies { classpath("io.github.cdsap.talaiot.plugin:base:") } } apply(plugin = "io.github.cdsap.talaiot.plugin.base") ``` -------------------------------- ### Configure Talaiot Metrics Source: https://context7.com/cdsap/talaiot/llms.txt Enable predefined metric groups and define custom key-value pairs for build and task reporting. ```kotlin // build.gradle.kts talaiot { metrics { // Enable/disable predefined metric groups (all true by default) defaultMetrics = true // RootProjectName, GradleRequestedTasks, GradleVersion gitMetrics = true // GitUser, GitBranch performanceMetrics = true // CPU count, memory, JVM settings gradleSwitchesMetrics = true // Caching, parallel, configuration cache settings environmentMetrics = true // Hostname, charset processMetrics = true // Gradle and Kotlin daemon process info // Generate unique build ID (can cause high cardinality in time-series DBs) generateBuildId = false // Add simple key-value build metrics customBuildMetrics( "kotlinVersion" to "1.9.0", "javaVersion" to "17", "buildType" to "debug" ) // Add simple key-value task metrics customTaskMetrics( "workerId" to System.getenv("CI_WORKER_ID") ?: "local" ) } } ``` -------------------------------- ### Configure ElasticSearchPublisher in Talaiot Source: https://github.com/cdsap/talaiot/wiki/Publishers Set up the ElasticSearchPublisher to send task and build metrics to an ElasticSearch instance. Specify the ElasticSearch URL and index names for tasks and builds. ```kotlin publishers { elasticSearchPublisher { url = "http://localhost:9200" taskIndexName = "task" buildIndexName = "build" } } ``` -------------------------------- ### Implement Publisher Interface Source: https://github.com/cdsap/talaiot/wiki/Publishers Interface definition required for creating custom build report publishers. ```kotlin interface Publisher { fun publish(report: ExecutionReport) } ``` -------------------------------- ### CustomPublisher Implementation Source: https://github.com/cdsap/talaiot/wiki/Publishers A basic implementation of the Publisher interface that prints the number of tasks. ```kotlin class CustomPublisher : Publisher { override fun publish(report: ExecutionReport) { println("[CustomPublisher] : Number of tasks = ${report.tasks?.size}") } } ``` -------------------------------- ### Enable Timeline Publisher Source: https://context7.com/cdsap/talaiot/llms.txt Enable the timeline publisher to generate a visual HTML timeline showing task execution across different workers. No specific configuration parameters are needed beyond enabling the publisher. ```kotlin // build.gradle.kts talaiot { publishers { // Simple boolean to enable timelinePublisher = true } } // Output file location: build/reports/talaiot/timeline.html // Opens in browser to show visual timeline of parallel task execution ``` -------------------------------- ### Custom Publisher Implementation Source: https://github.com/cdsap/talaiot/wiki/Publishers How to define and use custom publishers in Talaiot. ```APIDOC ## Custom Publisher ### Description Allows defining custom Publishers to meet specific reporting requirements. ### Configuration - **customPublisher** (CustomPublisher) - Description: A custom Publisher instance. ### Interface Definition ```kotlin interface Publisher { fun publish(report: ExecutionReport) } ``` ### ExecutionReport Data Class ```kotlin data class ExecutionReport( var environment: Environment = Environment(), var customProperties: CustomProperties = CustomProperties(), var beginMs: String? = null, var endMs: String? = null, var durationMs: String? = null, var configurationDurationMs: String? = null, var tasks: List? = null, var unfilteredTasks: List? = null, var buildId: String? = null, var rootProject: String? = null, var requestedTasks: String? = null, var success: Boolean = false, var scanLink: String? = null, var buildInvocationId: String? = null ) ``` ### Custom Publisher Example ```kotlin class CustomPublisher : Publisher { override fun publish(report: ExecutionReport) { println("[CustomPublisher] : Number of tasks = ${report.tasks?.size}") } } ``` ### Talaiot Configuration (Kotlin DSL) ```groovy talaiot { logger = LogTracker.Mode.INFO publishers { customPublisher = CustomPublisher() } } ``` ### Talaiot Configuration (Groovy DSL) ```groovy talaiot { publishers { customPublisher(new CustomPublisher()) } } ``` ``` -------------------------------- ### Apply Talaiot Plugin Source: https://github.com/cdsap/talaiot/wiki/Groovy-setup Apply the Talaiot plugin to the project. ```groovy apply plugin: 'talaiot' ``` -------------------------------- ### Configure Standard Plugin with Kotlin DSL Source: https://github.com/cdsap/talaiot/blob/master/README.md Apply the standard Talaiot plugin using the plugins DSL or legacy application method in Kotlin. ```kotlin plugins { id("io.github.cdsap.talaiot") version "" } ``` ```kotlin buildscript { repositories { gradlePluginPortal() } dependencies { classpath("io.github.cdsap:talaiot:") } } apply(plugin = "io.github.cdsap.talaiot") ``` -------------------------------- ### Configure Elasticsearch Publisher Source: https://context7.com/cdsap/talaiot/llms.txt Configure the Elasticsearch publisher to index build and task metrics for full-text search and analytics. Requires URL, task index name, and build index name. ```kotlin // build.gradle.kts talaiot { publishers { elasticSearchPublisher { // Required configuration url = "http://localhost:9200" // Index names for tasks and builds taskIndexName = "gradle-tasks" buildIndexName = "gradle-builds" // Control what gets published publishBuildMetrics = true publishTaskMetrics = true } } } ``` -------------------------------- ### Configure Talaiot Plugin Source: https://github.com/cdsap/talaiot/wiki/Groovy-setup Define custom metrics and configure the logger and publishers for Talaiot. ```groovy import com.cdsap.talaiot.logger.LogTracker def localMetrics = [ "version" : "3.2", "specialBuild": "false" ] talaiot { logger = LogTracker.Mode.INFO publishers { outputPublisher{} } metrics { customMetrics(localMetrics) } } ``` -------------------------------- ### Report Simple Custom Metrics Source: https://github.com/cdsap/talaiot/wiki/Metrics Use customBuildMetrics or customTaskMetrics for quick key-value reporting without creating a dedicated class. ```kotlin talaiot { metrics { customBuildMetrics( "kotlinVersion" to $kotlinVersion, "javaVersion" to $javaVersion ) customTaskMetrics( "taskPid" to $pid ) } } ``` -------------------------------- ### Configure Talaiot with Kotlin DSL Source: https://context7.com/cdsap/talaiot/llms.txt Apply the standard Talaiot plugin and configure basic logging and JSON output using Kotlin DSL. ```kotlin // build.gradle.kts plugins { id("io.github.cdsap.talaiot") version "2.1.1" } // Basic configuration talaiot { logger = io.github.cdsap.talaiot.logger.LogTracker.Mode.INFO publishers { // Enable JSON output jsonPublisher = true } } ``` -------------------------------- ### Apply Individual Talaiot Plugins Source: https://context7.com/cdsap/talaiot/llms.txt Use specific plugins to reduce dependencies by only including the required publisher functionality. ```kotlin // build.gradle.kts - Using only the base plugin plugins { id("io.github.cdsap.talaiot.plugin.base") version "2.1.1" } // Available individual plugins: // io.github.cdsap.talaiot.plugin.base - JSON, Output, Timeline publishers // io.github.cdsap.talaiot.plugin.elasticsearch - Elasticsearch publisher // io.github.cdsap.talaiot.plugin.influxdb - InfluxDB 1.x publisher // io.github.cdsap.talaiot.plugin.influxdb2 - InfluxDB 2.x (Flux) publisher // io.github.cdsap.talaiot.plugin.pushgateway - Prometheus PushGateway publisher // io.github.cdsap.talaiot.plugin.rethinkdb - RethinkDB publisher ``` -------------------------------- ### Configure Individual Plugins with Groovy DSL Source: https://github.com/cdsap/talaiot/blob/master/README.md Apply specific Talaiot plugins like the base plugin using Groovy DSL. ```groovy plugins { id "io.github.cdsap.talaiot.plugin.base" version "" } ``` ```groovy buildscript { repositories { gradlePluginPortal() } dependencies { classpath "io.github.cdsap.talaiot.plugin:base:" } } apply plugin: "io.github.cdsap.talaiot.plugin.base" ``` -------------------------------- ### Enable JSON Publisher Source: https://github.com/cdsap/talaiot/blob/master/README.md Enable the JSON publisher to output build results in JSON format. This is a simple boolean flag within the publishers block. ```kotlin publishers { jsonPublisher = true } ``` -------------------------------- ### Configure Talaiot OutputPublisher Source: https://github.com/cdsap/talaiot/wiki/Publishers Enables the output publisher within the Talaiot Gradle configuration block. ```gradle talaiot { publishers{ outputPublisher } } ``` -------------------------------- ### Configure Build and Task Filters Source: https://github.com/cdsap/talaiot/blob/master/README.md Define inclusion and exclusion rules for tasks, modules, and build outcomes to control which data is published. ```kotlin filter { tasks { excludes = arrayOf("preDebugBuild", "processDebugResources") } modules { excludes = arrayOf(":app") } threshold { minExecutionTime = 10 } build { success = true requestedTasks { includes = arrayOf(":app:assemble.*") excludes = arrayOf(":app:generate.*") } } } ``` -------------------------------- ### Configure Talaiot with Groovy DSL Source: https://context7.com/cdsap/talaiot/llms.txt Apply the Talaiot plugin using the legacy buildscript dependency method in Groovy. ```groovy // build.gradle buildscript { repositories { gradlePluginPortal() } dependencies { classpath "io.github.cdsap:talaiot:2.1.1" } } apply plugin: "io.github.cdsap.talaiot" talaiot { logger = io.github.cdsap.talaiot.logger.LogTracker.Mode.INFO publishers { outputPublisher {} } } ``` -------------------------------- ### Configure InfluxDb Publisher in Talaiot Source: https://github.com/cdsap/talaiot/blob/master/README.md Standard configuration block for the InfluxDb publisher, including optional execution time filtering. ```gradle talaiot { publishers { influxDbPublisher { dbName = "tracking" url = "http://localhost:8086" taskMetricName = "task" buildMetricName = "build" } } filter { threshold { minExecutionTime = 10 } } } ``` -------------------------------- ### Gradle Profiler Scenario Configuration Source: https://github.com/cdsap/talaiot/blob/master/README.md This configuration defines a scenario for Gradle Profiler to trigger builds. It specifies tasks, versions, and build arguments for performance testing. ```gradle assemble { tasks = ["clean"] } clean_build { versions = ["5.1"] tasks = ["assemble"] gradle-args = ["--parallel"] cleanup-tasks = ["clean"] run-using = cli warm-ups = 20 } ``` -------------------------------- ### Configure HybridPublisher in Gradle Source: https://github.com/cdsap/talaiot/blob/master/README.md Uses a combination of ElasticSearch and InfluxDb publishers to report build and task metrics respectively. ```kotlin publishers { hybridPublisher { taskPublisher = ElasticSearchPublisherConfiguration().apply { url = "http://localhost:9200" buildIndexName = "build" taskIndexName = "task" } buildPublisher = InfluxDbPublisherConfiguration().apply { dbName = "tracking" url = "http://localhost:8086" buildMetricName = "build" taskMetricName = "task" } } } ``` -------------------------------- ### Configure Standard Plugin with Groovy DSL Source: https://github.com/cdsap/talaiot/blob/master/README.md Apply the standard Talaiot plugin using the plugins DSL or legacy application method in Groovy. ```groovy plugins { id "io.github.cdsap.talaiot" version "" } ``` ```groovy buildscript { repositories { gradlePluginPortal() } dependencies { classpath "io.github.cdsap:talaiot:" } } apply plugin: "io.github.cdsap.talaiot" ``` -------------------------------- ### Output Configuration Source: https://github.com/cdsap/talaiot/wiki/Publishers Configuration options for the output publisher. ```APIDOC ## OutputConfiguration ### Description Configuration options for the output publisher. ### Properties - **order** (string) - Description: Disable the output of the execution. - **numberOfTasks** (string) - Description: Disable the output of the execution. ### Example ```groovy talaiot { publishers { outputPublisher } } ``` ``` -------------------------------- ### Configure InfluxDbPublisher with Custom Retention Policy Source: https://github.com/cdsap/talaiot/wiki/Publishers Use this configuration to publish build results to an InfluxDb server with a custom retention policy. Ensure the InfluxDb server and database are correctly configured. ```scala influxDbPublisher { dbName = "xxxxxx" url = "xxxxxx" retentionPolicyConfiguration { name = "customRp" duration = "4w" shardDuration = "30m" replicationFactor = 1 isDefault = true } } ``` -------------------------------- ### Configure JsonPublisher in Talaiot Source: https://github.com/cdsap/talaiot/wiki/Publishers Enable the JsonPublisher to export build results in JSON format. This is a simple boolean flag in the publishers configuration. ```kotlin publishers { jsonPublisher = true } ``` -------------------------------- ### Register CustomPublisher in Groovy Source: https://github.com/cdsap/talaiot/wiki/Publishers Alternative syntax for registering a custom publisher using Groovy DSL. ```groovy talaiot { publishers { customPublisher(new CustomPublisher()) } } ``` -------------------------------- ### PushGatewayPublisher Configuration Source: https://github.com/cdsap/talaiot/wiki/Publishers Configures sending collected metrics to a Prometheus PushGateway server. ```APIDOC ## PushGatewayPublisher ### Description Sends collected build and task metrics to a defined PushGateway server. ### Parameters #### Configuration Properties - **url** (string) - Required - Url of the PushGateway Server - **taskJobName** (string) - Required - Name of the job required for the tasks metrics to be exported to Prometheus - **buildJobName** (string) - Required - Name of the job required for the build metrics to be exported to Prometheus - **publishBuildMetrics** (boolean) - Optional - Publish build metrics of the publisher, true by default - **publishTaskMetrics** (boolean) - Optional - Publish tasks metrics of the publisher, true by default ``` -------------------------------- ### Implement Custom Metric Classes Source: https://context7.com/cdsap/talaiot/llms.txt Extend SimpleMetric to collect specialized data and register them within the Talaiot configuration. ```kotlin // build.gradle.kts import io.github.cdsap.talaiot.metrics.SimpleMetric import io.github.cdsap.talaiot.entities.ExecutionReport // Define a custom metric class class GitBranchMetric : SimpleMetric( provider = { Runtime.getRuntime() .exec("git rev-parse --abbrev-ref HEAD") .inputStream.bufferedReader().readText().trim() }, assigner = { report, value -> report.customProperties.buildProperties["gitBranch"] = value } ) class BuildMachineMetric : SimpleMetric( provider = { System.getenv("CI_MACHINE_NAME") ?: "local" }, assigner = { report, value -> report.customProperties.buildProperties["buildMachine"] = value } ) // Use custom metrics in configuration talaiot { metrics { customMetrics( GitBranchMetric(), BuildMachineMetric(), // Include specific predefined metrics io.github.cdsap.talaiot.metrics.HostnameMetric(), io.github.cdsap.talaiot.metrics.ProcessorCountMetric() ) } } ``` -------------------------------- ### Configure Custom Metrics Source: https://github.com/cdsap/talaiot/blob/master/README.md Define custom build and task metrics within the talaiot block. Use customMetrics for objects, or customBuildMetrics and customTaskMetrics for key-value pairs. ```kotlin talaiot { metrics { // You can add your own custom Metric objects: customMetrics( MyCustomMetric(), // Including some of the provided metrics, individually. HostnameMetric() ) // Or define build or task metrics directly: customBuildMetrics( "kotlinVersion" to $kotlinVersion, "javaVersion" to $javaVersion ) customTaskMetrics( "customProperty" to $value ) } } ``` -------------------------------- ### ElasticSearchPublisher Configuration Source: https://github.com/cdsap/talaiot/wiki/Publishers Configures sending metrics to an ElasticSearch server. ```APIDOC ## ElasticSearchPublisher ### Description Sends collected task and build metrics to an ElasticSearch server. ### Parameters #### Configuration Properties - **url** (string) - Required - ElasticSearch server URL - **taskIndexName** (string) - Required - Name for the index used to report tasks metrics - **buildIndexName** (string) - Required - Name for the index used to report build metrics - **publishBuildMetrics** (boolean) - Optional - Publish build metrics of the publisher, true by default - **publishTaskMetrics** (boolean) - Optional - Publish tasks metrics of the publisher, true by default ``` -------------------------------- ### Register Custom Metric Class Source: https://github.com/cdsap/talaiot/wiki/Metrics Add custom metric instances to the metrics configuration block. ```kotlin talaiot { metrics { customMetrics( // Our custom metric, HelloMetric. HelloMetric() ) } } ``` -------------------------------- ### Define Custom Publishers Source: https://github.com/cdsap/talaiot/blob/master/README.md Registers custom publisher implementations within the Talaiot configuration block. ```kotlin talaiot { publishers { // You can define one or more custom publishers: customPublishers( MyCustomPublisher() ) } } ``` -------------------------------- ### Use Experimental Provider Metrics Source: https://context7.com/cdsap/talaiot/llms.txt Define ValueSource implementations for lazy metric evaluation compatible with the Gradle Configuration Cache. ```kotlin // build.gradle.kts import io.github.cdsap.talaiot.metrics.ExperimentalMetricsApi import org.gradle.api.provider.ValueSource import org.gradle.api.provider.ValueSourceParameters // Define a ValueSource for lazy metric evaluation abstract class GetMemoryUsage : ValueSource { override fun obtain(): String { val runtime = Runtime.getRuntime() val usedMemory = (runtime.totalMemory() - runtime.freeMemory()) / 1024 / 1024 return "${usedMemory}MB" } } talaiot { metrics { // Metrics evaluated at execution phase start @OptIn(ExperimentalMetricsApi::class) initialProviderMetrics( "initialMemory" to providers.of(GetMemoryUsage::class) {} ) // Metrics evaluated after build finishes @OptIn(ExperimentalMetricsApi::class) finalProviderMetrics( "finalMemory" to providers.of(GetMemoryUsage::class) {} ) } } ``` -------------------------------- ### ExecutionReport data structure Source: https://context7.com/cdsap/talaiot/llms.txt Reference the ExecutionReport and TaskLength data classes to understand available build metrics. ```kotlin // Data structure available in publishers data class ExecutionReport( // Build timing var beginMs: String?, // Build start timestamp var endMs: String?, // Build end timestamp var durationMs: String?, // Total build duration var configurationDurationMs: String?, // Configuration phase duration var executionDurationMs: String?, // Execution phase duration // Build info var rootProject: String?, // Root project name var requestedTasks: String?, // Tasks requested by user var success: Boolean, // Build success status var buildId: String?, // Unique build identifier var buildInvocationId: String?, // Gradle's build invocation ID var scanLink: String?, // Gradle Build Scan URL var configurationCacheHit: Boolean, // Configuration cache hit status // Tasks var tasks: List?, // Filtered task list var unfilteredTasks: List?, // All executed tasks // Environment and custom properties var environment: Environment, // System/environment info var customProperties: CustomProperties // User-defined metrics ) data class TaskLength( val ms: Long, // Task duration in milliseconds val taskName: String, // Simple task name val taskPath: String, // Full task path with module val state: TaskMessageState, // EXECUTED, FROM_CACHE, UP_TO_DATE, etc. val module: String, // Module name val startMs: Long, // Start timestamp val stopMs: Long, // End timestamp val type: String, // Task type val rootNode: Boolean // Whether task was directly requested ) enum class TaskMessageState { FROM_CACHE, // Task output retrieved from cache NO_SOURCE, // Task skipped due to no source files UP_TO_DATE, // Task skipped as output is up to date EXECUTED, // Task was fully executed FAILED, // Task execution failed SKIPPED // Task was skipped for other reasons } ``` -------------------------------- ### Add Talaiot to Classpath Source: https://github.com/cdsap/talaiot/wiki/Groovy-setup Include the Talaiot dependency in the buildscript classpath. ```groovy classpath "com.cdsap:talaiot:" ``` -------------------------------- ### HybridPublisher Configuration Source: https://github.com/cdsap/talaiot/wiki/Publishers Configures a composition of different publishers for tasks and build metrics. ```APIDOC ## HybridPublisher ### Description Allows composition over different publishers to report tasks and build metrics separately. ### Parameters #### Configuration Properties - **taskPublisher** (object) - Required - Publisher configuration used to publish tasks metrics - **buildPublisher** (object) - Required - Publisher configuration used to publish build metrics ``` -------------------------------- ### Combine Custom and Specific Predefined Metrics Source: https://github.com/cdsap/talaiot/wiki/Metrics Disable entire predefined groups and selectively include individual metrics as custom entries. ```kotlin talaiot { metrics { // We don't need all environment metrics, so we disable them here. environmentMetrics = false // Using custom metrics, we enable some of the environment metrics. customMetrics( // Our custom metric, HelloMetric. HelloMetric(), // Predefined metrics from the environment group that we want to // include in our report. DefaultCharsetMetric(), HostnameMetric() ) } } ``` -------------------------------- ### Configure Talaiot execution skipping Source: https://context7.com/cdsap/talaiot/llms.txt Use ignoreWhen to prevent Talaiot from running based on environment variables or Gradle properties. ```kotlin // build.gradle.kts talaiot { // Skip publishing when running on CI ignoreWhen { envName = "CI" envValue = "true" } } // Alternative: Skip based on Gradle property // ./gradlew build -PskipTalaiot=true talaiot { ignoreWhen { envName = "skipTalaiot" envValue = "true" } } ``` -------------------------------- ### Configure IgnoreWhen Condition Source: https://github.com/cdsap/talaiot/blob/master/README.md Specify environment variables that, when matched, prevent Talaiot from publishing build results. ```kotlin talaiot { ignoreWhen { envName = "CI" envValue = "true" } } ``` -------------------------------- ### TaskDependencyGraphPublisher Configuration Source: https://github.com/cdsap/talaiot/wiki/Publishers Configures the generation of task dependency graphs in various formats. ```APIDOC ## TaskDependencyGraphPublisher ### Description Generates a task dependency graph based on the provided configuration. ### Parameters #### Configuration Properties - **ignoreWhen** (string) - Optional - Configuration to ignore the execution of the publisher - **html** (boolean) - Optional - Export the task dependency graph in Html format with support of vis.js - **gexf** (string) - Optional - Export the task dependency graph in gexf format - **dot** (string) - Optional - Export the task dependency graph in png format via Graphviz ``` -------------------------------- ### InfluxDbPublisher Configuration Source: https://github.com/cdsap/talaiot/blob/master/README.md Configuration for the InfluxDbPublisher, which sends collected values to an InfluxDb server. ```APIDOC ## InfluxDbPublisher Configuration ### Description Talaiot will send to the InfluxDb server defined in the configuration the values collected during the execution. ### Properties #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```groovy talaiot { publishers { influxDbPublisher { dbName = "tracking" url = "http://localhost:8086" taskMetricName = "task" buildMetricName = "build" } } filter { threshold { minExecutionTime = 10 } } } ``` ### Response #### Success Response (200) This endpoint does not return a response body as it is a configuration block. #### Response Example None ``` -------------------------------- ### ExecutionReport Data Class Source: https://github.com/cdsap/talaiot/wiki/Publishers The data structure containing build information passed to the publish function. ```kotlin data class ExecutionReport( var environment: Environment = Environment(), var customProperties: CustomProperties = CustomProperties(), var beginMs: String? = null, var endMs: String? = null, var durationMs: String? = null, var configurationDurationMs: String? = null, var tasks: List? = null, var unfilteredTasks: List? = null, var buildId: String? = null, var rootProject: String? = null, var requestedTasks: String? = null, var success: Boolean = false, var scanLink: String? = null, var buildInvocationId: String? = null ) ``` -------------------------------- ### Register CustomPublisher in Talaiot Source: https://github.com/cdsap/talaiot/wiki/Publishers Registers the custom publisher instance within the Talaiot configuration block. ```gradle talaiot { logger = LogTracker.Mode.INFO publishers { customPublisher = CustomPublisher() } } ``` -------------------------------- ### Create Custom Metric Class Source: https://github.com/cdsap/talaiot/wiki/Metrics Extend SimpleMetric to define custom logic for extracting and assigning report properties. ```kotlin class HelloMetric : SimpleMetric( provider = { "Hello!" }, assigner = { report, value -> report.customProperties.buildProperties["hello"] = value } ) ``` -------------------------------- ### InfluxDb2Publisher Configuration Source: https://github.com/cdsap/talaiot/blob/master/README.md Configuration for the InfluxDb2Publisher, which sends collected values to an InfluxDb (Flux) server. ```APIDOC ## InfluxDb2Publisher Configuration ### Description Talaiot will send to the InfluxDb (Flux) server defined in the configuration the values collected during the execution. ### Properties #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```groovy talaiot { publishers { influxDb2Publisher { token = "your_influxdb_token" url = "http://localhost:8086" org = "your_org" bucket = "your_bucket" taskMetricName = "task" buildMetricName = "build" } } } ``` ### Response #### Success Response (200) This endpoint does not return a response body as it is a configuration block. #### Response Example None ``` -------------------------------- ### InfluxDbPublisher Properties Source: https://github.com/cdsap/talaiot/blob/master/README.md Detailed properties for the InfluxDbPublisher. ```APIDOC ## InfluxDbPublisher Properties ### Description Properties available for configuring the InfluxDbPublisher. ### Method None (Configuration Block) ### Endpoint None (Configuration Block) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Properties Table | Property | Description | |----------------------------- |-------------------------------------------------------------------------------------| | dbName | Name of the database | | url | Url of the InfluxDb Server | | taskMetricName | Name of the metric used for specific task in the execution | | buildMetricName | Name of the metric used for the overall information of the build in the execution | | username | username which is used to authorize against the influxDB instance (optional) | | password | password for the username which is used to authorize against the influxDB (optional)| | retentionPolicyConfiguration | retention policy which is used for writing points | | publishBuildMetrics | Publish build metrics of the publisher, true by default | | publishTaskMetrics | Publish tasks metrics of the publisher, true by default | | buildTags | Collection of BuildMetrics used as tags | | taskTags | Collection of TaskMetrics used as tags | For complete list of - build tags check: https://github.com/cdsap/Talaiot/blob/master/library/core/talaiot/src/main/kotlin/io/github/cdsap/talaiot/metrics/BuildMetrics.kt - task tags check: https://github.com/cdsap/Talaiot/blob/master/library/core/talaiot/src/main/kotlin/io/github/cdsap/talaiot/metrics/TaskMetrics.kt If you need to include custom metrics as tags, you need to use the type `Custom` ``` -------------------------------- ### InfluxDb2Publisher Properties Source: https://github.com/cdsap/talaiot/blob/master/README.md Detailed properties for the InfluxDb2Publisher. ```APIDOC ## InfluxDb2Publisher Properties ### Description Properties available for configuring the InfluxDb2Publisher. ### Method None (Configuration Block) ### Endpoint None (Configuration Block) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Properties Table | Property | Description | |----------------------------- |-------------------------------------------------------------------------------------| | token | Influx access token | | url | Url of the InfluxDb Server | | taskMetricName | Name of the metric used for specific task in the execution | | buildMetricName | Name of the metric used for the overall information of the build in the execution | | org | Organization name | | bucket | Name of bucket | | publishBuildMetrics | Publish build metrics of the publisher, true by default | | publishTaskMetrics | Publish tasks metrics of the publisher, true by default | | buildTags | Collection of BuildMetrics used as tags | | taskTags | Collection of TaskMetrics used as tags | ``` -------------------------------- ### Disable Predefined Metrics Source: https://github.com/cdsap/talaiot/wiki/Metrics Use the metrics block within the talaiot configuration to toggle specific predefined metric groups. ```kotlin talaiot { metrics { gitMetrics = false performanceMetrics = false } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.