

brew install prometheus
brew services start prometheus
brew services list // 현재 실행 상태 확인(started)
brew install grafana
brew services start grafana
build.gradle에 다음 의존성을 추가한다.// actuator
implementation 'org.springframework.boot:spring-boot-starter-actuator'
// prometheus
implementation 'io.micrometer:micrometer-registry-prometheus'
application.yaml에 Prometheus 엔드포인트를 노출하도록 설정을 추가한다.management:
endpoints:
web:
exposure:
include: prometheus # prometheus 엔드포인트 노출
base-path: /actuator # 기본 경로 (default: /actuator)
설정 후,
http://localhost:8080/actuator/prometheus로 접속
prometheus.yml 파일을 수정 후 저장한다. (Mac 기준)open /opt/homebrew/etc/prometheus.yml // 파일 열기
prometheus.ymlscrape_configs:
- job_name: 'spring-actuator'
metrics_path: '/actuator/prometheus'
static_configs:
- targets: ['localhost:8080'] # Spring Boot 앱 포트
brew services restart prometheus
http://localhost:9090으로 접속 후 Status > Targets 메뉴에서 Spring Boot 타겟이 UP 상태인지 확인한다.
http://localhost:3000/login 으로 접속
Prometheus를 선택한다.

http://localhost:9090를 입력 후 저장한다.
Metrics 필드를 선택 후 Run queries 버튼을 클릭한다.

친절하게 운영체제 별로 설치 가이드 bb