From c4e50d3daee45f06c18df7c2cfdff95a18a9400c Mon Sep 17 00:00:00 2001 From: asteriskzie Date: Mon, 20 May 2024 10:35:15 +0700 Subject: [PATCH] Configure prometheus to monitor deployed app --- .monitoring/prometheus/prometheus.yml | 7 +++++-- build.gradle.kts | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.monitoring/prometheus/prometheus.yml b/.monitoring/prometheus/prometheus.yml index 94f2cfe..f454fff 100644 --- a/.monitoring/prometheus/prometheus.yml +++ b/.monitoring/prometheus/prometheus.yml @@ -1,8 +1,11 @@ scrape_configs: - - job_name: 'MyAppMetrics' + - job_name: 'Snackscription Metrics' metrics_path: '/actuator/prometheus' scrape_interval: 3s static_configs: - targets: ['host.docker.internal:8080'] labels: - application: 'Snackscription Review' \ No newline at end of file + application: 'Snackscription Review' + - targets: ['34.124.152.90'] + labels: + application: 'Snackscription Review (deployed)' \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 01cc3e8..0acc097 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -27,10 +27,11 @@ dependencies { implementation("org.springframework.boot:spring-boot-starter-thymeleaf") implementation("org.springframework.boot:spring-boot-starter-web") implementation("org.springframework.boot:spring-boot-starter-actuator") + implementation("io.micrometer:micrometer-registry-prometheus") + implementation("io.micrometer:micrometer-core") compileOnly("org.projectlombok:lombok") developmentOnly("org.springframework.boot:spring-boot-devtools") runtimeOnly("org.postgresql:postgresql") - runtimeOnly("io.micrometer:micrometer-registry-prometheus") annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") annotationProcessor("org.projectlombok:lombok") testImplementation("org.springframework.boot:spring-boot-starter-test")