{"id":21899096,"url":"https://github.com/johnsonlee/gradle-prometheus-plugin","last_synced_at":"2025-04-15T18:54:09.533Z","repository":{"id":57745446,"uuid":"332365262","full_name":"johnsonlee/gradle-prometheus-plugin","owner":"johnsonlee","description":"Prometheus metrics generator for Gradle","archived":false,"fork":false,"pushed_at":"2021-12-12T15:36:20.000Z","size":350,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T23:51:14.579Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnsonlee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-24T04:16:20.000Z","updated_at":"2024-07-30T02:29:38.000Z","dependencies_parsed_at":"2022-08-30T23:40:35.977Z","dependency_job_id":null,"html_url":"https://github.com/johnsonlee/gradle-prometheus-plugin","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsonlee%2Fgradle-prometheus-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsonlee%2Fgradle-prometheus-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsonlee%2Fgradle-prometheus-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsonlee%2Fgradle-prometheus-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnsonlee","download_url":"https://codeload.github.com/johnsonlee/gradle-prometheus-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249135763,"owners_count":21218365,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-28T14:37:34.935Z","updated_at":"2025-04-15T18:54:09.516Z","avatar_url":"https://github.com/johnsonlee.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Overview\n\nThis project is used for Gradle build performance monitoring, it consist of 2 parts:\n\n1. Gradle metrics generator - [GradlePrometheusPlugin.kt](./src/main/kotlin/io/johnsonlee/gradle/metrics/GradlePrometheusPlugin.kt)\n\n    [Prometheus](https://prometheus.io) metrics generator for Gradle project\n    \n1. Gradle metrics exporter - [exporter/index.js](./exporter/index.js)\n\n    Export metrics to [Prometheus](https://prometheus.io) service, the metrics can be visualized by [Grafana](https://grafana.com)\n\nUsing this project, we can build a pretty dashboard:\n\n![Screenshot](./art/screenshot.png)\n\n## Prerequisite\n\n- Docker\n- Docker Compose\n- Prometheus\n\n    You can refer [dockerify/prometheus](https://github.com/johnsonlee/dockerify/tree/main/prometheus) to deploy your own Prometheus service.\n\n- Grafana\n\n    You can refer [dockerify/grafana](https://github.com/johnsonlee/dockerify/tree/main/grafana) to deploy your own Grafana service\n\n## Getting Started\n\n### Start Metrics Exporter\n\nThe metrics exporter can be easily started from local:\n\n```bash\ncd exporter \u0026\u0026 docker-compose up -d\n```\n\nor started from docker hub\n\n```bash\ndocker run -p 9300:3000 johnsonlee/gradle-prometheus-exporter\n```\n\nThen check the metrics exporter by accessing: http://localhost:9300/metrics\n\n### Integrate Metrics Exporter with Prometheus\n\nTo make the metrics exporter service discoverable by Prometheus service, you have to update [prometheus.yml](https://github.com/johnsonlee/dockerify/blob/main/prometheus/prometheus.yml):\n\n```\nscrape_configs:\n- job_name: cadvisor\n  scrape_interval: 5s\n  static_configs:\n  - targets:\n    - cadvisor:8080\n- job_name: gradle-prometheus-exporter\n  scrape_interval: 5s\n  static_configs:\n  - targets:\n    - \u003cthe-ip-address-of-exporter\u003e:9300\n```\n\nAfter updated, restart prometheus service by executing the following command:\n\n```bash\ndocker-compose restart promethues\n```\n\n### Integrate with Metrics Generator\n\nThe gradle plugin can by easily integrated by [Gradle Initialization Scripts](https://docs.gradle.org/current/userguide/init_scripts.html) with Gradle project, just put [init.gradle](https://github.com/johnsonlee/gradle-prometheus-plugin/blob/main/src/main/resources/init.gradle) under one of following directories:\n\n1. *USER_HOME/.gradle/*\n1. *USER_HOME/.gradle/init.d/*\n1. *GRADLE_HOME/init.d/*\n\nThen config system property `metrics.endpoint` in `gradle.properties`:\n\n```properties\nsystemProp.metrics.endpoint=http://localhost:9300/metrics\n```\n\nThen build your project:\n\n```bash\n./gradlew build\n```\n\nAfter build finished, check the metrics from http://localhost:9300/metrics\n\n### Create Dashboard for Gradle Metrics\n\nIf everything works well, the metrics generated by Gradle plugin are supposed to be discovered by Prometheus as following:\n\n- gradle_project_evaluation_duration_ms\n- gradle_settings_duration_ms\n- gradle_task_execution_duration_ms\n- gradle_build_duration_ms\n\nThen, we can create dashboard with those metrics.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnsonlee%2Fgradle-prometheus-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnsonlee%2Fgradle-prometheus-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnsonlee%2Fgradle-prometheus-plugin/lists"}