Skip to content

Commit

Permalink
Enable support for metrics collection with Prometheus via Micrometer
Browse files Browse the repository at this point in the history
  • Loading branch information
miguno committed Sep 8, 2024
1 parent 1d9a7ce commit 55d3575
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ Features:
and [/v3/api-docs](http://localhost:8123/v3/api-docs)
- [Spring Actuator](https://docs.spring.io/spring-boot/reference/actuator/endpoints.html)
at endpoint [/actuator](http://localhost:8123/actuator), e.g. for
[healthchecks](http://localhost:8123/actuator/health)
[healthchecks](http://localhost:8123/actuator/health) or [Prometheus
metrics](http://localhost:8123/actuator/prometheus)
- Maven for build management (see [pom.xml](pom.xml)), using
[Maven Wrapper](https://github.com/apache/maven-wrapper)
- [GitHub Actions workflows](https://github.com/miguno/java-docker-build-tutorial/actions) for
Expand Down
18 changes: 18 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
<maven.compiler.release>${java.version}</maven.compiler.release>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<!-- Dependencies (other than Maven plugins) -->
<micrometer.version>1.13.3</micrometer.version>
<!-- Maven plugins -->
<maven-project-info-reports-plugin.version>3.7.0</maven-project-info-reports-plugin.version>
<maven-enforcer-plugin.version>3.5.0</maven-enforcer-plugin.version>
Expand Down Expand Up @@ -104,6 +106,21 @@
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<dependency>
<!--
Exposes metrics via a Prometheus actuator endpoint.
Adds the following endpoint:
1. `/actuator/prometheus`
https://docs.spring.io/spring-boot/api/rest/actuator/prometheus.html#prometheus
https://docs.micrometer.io/micrometer/reference/implementations/prometheus.html
-->
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>${micrometer.version}</version>
</dependency>

<dependency>
<!--
Integrates Spring Boot and Swagger UI.
Expand All @@ -118,6 +135,7 @@
<version>${springdoc.version}</version>
</dependency>


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
Expand Down

0 comments on commit 55d3575

Please sign in to comment.