You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
왜 “비즈니스 메트릭”인가? — 무엇을, 어디서, 어떻게 측정할까
1) 기술 메트릭만으로는 모르는 것들
2) 예제 도메인(주문/취소/재고)
/order,/cancel,/stock(초기 재고: 100)3) 최소 구성 요약
/actuator/metrics/**,/actuator/prometheus/actuator/prometheus를 pull → Grafana에서 PromQL로 시각화/알람 설정페이지 2) 카운터 제대로 쓰기 — 수치가 “올라만 가는” 것들
1) Counter 핵심
*_total.2) 코드 — 수동 등록 vs AOP 기반 자동 계측
(a) 수동 등록 예시)
name=my.order,method태그로 주문/취소 구분. Prometheus에선my_order_total로 노출됩니다.(b) AOP 자동 계측 — @counted
result,exception,method,class같은 태그가 붙어 성공/예외 레이블링이 가능해집니다.3) 관측 & 대시보드
/actuator/metrics/my.order→ COUNT/태그 확인my_order_total{class="...", method="order"} 1.0increase(my_order_total{method="order"}[1m])/increase(my_order_total{method="cancel"}[1m])→ 카운터는 누적만 늘기 때문에 증가율 함수(increase, rate)로 봅니다.
4) 실무 포인트
페이지 3) Timer로 “얼마나 오래 걸렸는지”까지
1) Timer가 주는 3종 세트
*_seconds_count(호출 수, 카운터)*_seconds_sum(총 소요시간 합)*_seconds_max(최대 소요시간, 게이지)sum / count(윈도우 집계로 직접 계산)2) 코드 — 수동 Timer vs @timed
(a) 수동 Timer
(b) @timed 로 전역 적용
3) 관측 & 대시보드 (Prometheus/Grafana 예)
increase(my_order_seconds_count{method="order"}[1m])increase(my_order_seconds_sum[1m]) / increase(my_order_seconds_count[1m])my_order_seconds_max{method="order"}/actuator/metrics/my.order에서 COUNT, TOTAL_TIME, MAX 확인4) 실무 포인트
sum/count로 계산(별도 평균 시계열은 없음).페이지 4) Gauge(현재값)와 운영 팁 — “보면 바로 아는” 대시보드와 알람
1) Gauge 핵심
2) 코드 — 게이지 등록 2가지 패턴
(a) 초기화 메서드에서 등록
(b) 더 간단히 — MeterBinder
3) 관측 & 대시보드
/actuator/metrics/my.stock→ VALUE(현재 값) 확인my_stockmy_stock그대로 표시 → 현재 재고 현황판에 적합4) 운영 구성 3층: 대시보드 → 트레이싱 → 로그
5) 알람 운영 베스트 프랙티스
Beta Was this translation helpful? Give feedback.
All reactions