From db5343fba36721cbdbf4cfe0d3fd6a1ea11761ba Mon Sep 17 00:00:00 2001 From: Menci Date: Sat, 7 Dec 2024 02:32:48 +0800 Subject: [PATCH] Add actuator and micrometer --- build.gradle.kts | 4 ++++ src/main/resources/application.properties | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 172db05d..89da707f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -46,6 +46,10 @@ dependencies { testImplementation("org.springframework.security:spring-security-test") implementation("net.logstash.logback:logstash-logback-encoder:7.4") + // Metrics + implementation("org.springframework.boot:spring-boot-starter-actuator") + implementation("io.micrometer:micrometer-registry-prometheus") + // Database runtimeOnly("org.mariadb.jdbc:mariadb-java-client:3.3.3") runtimeOnly("org.xerial:sqlite-jdbc:3.45.2.0") diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index df763c56..ffc41b93 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -33,3 +33,8 @@ spring.jpa.hibernate.ddl-auto=none # https://github.com/termstandard/colors#truecolor-support-in-output-devices # If you want to read the logs using a script, read the json logs in `logs` folder instead. spring.output.ansi.enabled=always + +# Metrics +management.server.port=8081 +management.endpoint.prometheus.enabled=true +management.endpoints.web.exposure.include=prometheus