Skip to content

Commit

Permalink
Add grafana and prometheus monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
sdikyarts committed May 25, 2024
1 parent bf9e606 commit b0d5d5e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ dependencies {
testImplementation("io.github.bonigarcia:selenium-jupiter:$seleniumJupiterVersion")
testImplementation("io.github.bonigarcia:webdrivermanager:$webdrivermanagerVersion")
testImplementation("org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion")
runtimeOnly("io.micrometer:micrometer-registry-prometheus:1.12.5")
implementation("org.springframework.boot:spring-boot-starter-actuator:3.2.5")
}

tasks.register<Test>("unitTest") {
Expand Down
19 changes: 19 additions & 0 deletions monitoring/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3.7'

services:
prometheus:
image: prom/prometheus:v2.44.0
container_name: prometheus
ports:
- "9090:9090"
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml

grafana:
image: grafana/grafana:9.5.2
container_name: grafana
ports:
- "3000:3000"
restart: unless-stopped
volumes:
- ./grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
7 changes: 7 additions & 0 deletions monitoring/grafana/provisioning/datasources/datasources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
8 changes: 8 additions & 0 deletions monitoring/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
scrape_configs:
- job_name: 'MyAppMetrics'
metrics_path: '/actuator/prometheus'
scrape_interval: 3s
static_configs:
- targets: ['host.docker.internal:8080']
labels:
application: 'subscription'
3 changes: 2 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
spring.application.name=subscription-admin
spring.profiles.active=${PRODUCTION:prod}
spring.profiles.active=${PRODUCTION:dev}
management.endpoints.web.exposure.include=*

0 comments on commit b0d5d5e

Please sign in to comment.