반응형
환경: springboot2.7.6, java17
micrometer
- jvm 기반의 애플리캐이션 metrics 제공
- springboot2 +
- premetheus 등 다양한 모니터링 시스템 지원
- (구) turbine server -> hystrix client
timer
- 짧은 지연 시간, 이벤트의 사용 빈도 측정
- 시계열로 이벤트의 시간, 호출 빈도 등 제공
- @Timed 제공
서비스 연동
1. dependency 추가
<!-- micrometer -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<!-- actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator </artifactId>
</dependency>
2. application.yml actuator 정보 추가
management:
endpoints:
web:
exposure:
include: info, metrics, prometheus #추가
3. @Timed 어노테이션으로 metrics 마킹
@GetMapping("/welcome")
@Timed(value = "users.welcome", longTask = true)
public String welcome(){
// return environment.getProperty("greeting.message");
return greeting.getMessage();
}
4. 추가한 metrics는 사용을 하면 /actuator/metrics 에 표기됨
4. 그리고 실제 호출정보는 /actuator/premetheus 에 남음
728x90
반응형
'개발 > spring-cloud' 카테고리의 다른 글
[open-feign] (Decoder, ErrorDecoder) 200+본문의 에러처리 + AOP (0) | 2024.09.25 |
---|---|
[spring-cloud] zipkin 분산 환경 모니터링 (0) | 2024.02.08 |
[resilience4j] circuit breaker (0) | 2024.02.08 |
[cloud] property값 암호화하여 사용하기 (0) | 2024.01.29 |
[cloud] spring cloud bus (0) | 2024.01.29 |