콘텐츠로 이동

관측성 (모니터링·로깅)

Dev/Prod 동일 아키텍처. 메트릭=Prometheus(pull), 로그=Loki(push), 시각화=Grafana.

1. 파이프라인

[메트릭] Actuator(Spring) / Node Exporter(호스트) ──pull── Prometheus(시계열 DB)
[로그]   앱 로그 ──push(Promtail)── Loki(라벨 기반 인덱스)
                                          └──────┬───────┘
                                            Grafana 시각화
  • Prometheus: 메트릭을 name{labels} value timestamp로 저장(pull)
  • Loki: 로그 전체를 인덱싱하지 않고 Label 기반 인덱스만 생성(성능). stream(label) + values([ts, line])
  • 수집 대상: 로그 수집 / Spring 앱 메트릭 / (MySQL·Redis) / 호스트 메트릭

2. 메트릭 / 로그 설계

  • Actuator 커스텀: url 라벨 없는 전체 요청 기준 수집 (카디널리티 폭증 방지), bucket 기준 확장 가능 raw 데이터
  • 로그: MDC 필터 + 카디널리티 고려 라벨링 + 도메인별 로그 구조

3. Grafana 대시보드

  • 컨테이너 모니터링, 디에듀 서버 관측성(Actuator/Loki 기반)
  • 로그 기반 통계: P99/P95
  • 로그 조회: 시간별·키워드·RequestID 단위 요청 추적
  • (Dev 대시보드 예시) theedu_JVM, theedu_Node Exporter Full
  • Loki 탐색: Connections → Datasources → Loki Explore → (app, theedu) + (logger, 클래스명) 선택

4. 컨테이너 (Prod)

dedu-grafana(grafana 10.4.3, :3000), dedu-loki(loki 2.9.8, :3100) — teams/engineering/guides/docker §3.

5. 관련