2025 03 14
2025-03-14¶
Kamon¶
참고: https://kamon.io/
참고: https://kamon.io/docs/latest/core/
참고: https://kamon.io/docs/latest/reporters/
참고: https://kamon.io/docs/latest/reporters/influxdb/
참고: https://jennifersoft.com/ko/blog/tech/what-is-application-performance-monitoring/
- APM
- APM (Application Performance Monitoring)
- 어플리케이션 성능 모니터링, 장애 감지 -> 대응의 시스템 관리 체계
- 응답 시간에 영향을 주는 액션들을 추적하게 도와줌
- HTTP 요청 ~ DB 까지 프로파일링을 통해 뭐가 병목인지
- backend가 느려지면 노티 받기
- 한곳에서 메트릭 영향 주는 것 관리하기
- public endpoint/internal operation 한눈에 모니터링
- APM (Application Performance Monitoring)
- 개요
- JVM 위의 모니터링 툴킷
- metrics 기록, trace request, 분산 시스템에서 propagate context 가능
- 메트릭 Core APIs
-
kamon-core- Metrics API: 몇가지의 instrument 타입 제공. 메트릭 기록 (counter, gauges, histogram, timers, range samplers) - tracing/context propagation - Tracing API: create, correlate, represent operation 분산 시스템 - Context API: 임의의 특정 request 데이터를 thread-process에 전파
- automatic instrumentation modules
- core 직접 쓰지 않고, 통합
-
kamon-akka,kamon-akka-remote- actor/router/dispatcher - actor group metrics/distributed message tracing/context propagation (local/cluster) -kamon-akka-http,kamon-play- 자동 context propagation & distributed tracing (서버-클라이언트 모두) - Akka HTTP, Play Framework -kamon-jdbc- hook all JDBC Calls - reporting modules
- 리포터 모듈은 모니터링 시스템에 수집한 데이터 공개/전송
Kamon.addReporter(...)
- 메트릭 Core APIs
-
- 서비스 코드는 Kamon API와 소통
- Reporters
- periodic snapshot of telemetry data
1. Combined Reporters
- Kamon APM: HTTP API로 Kamon APM에 데이터 전송
- Datadog: 3개의 별도 리포터로 보냄
- New Relic 2. Metrics Only
- Prometheus: 프로메테우스 exposition format으로 endpoint 긁어서 보여줌
- InfluxDB: InfluxDB에 line protocol로 보냄 3. Spans Only
- Zipkin: span 전송 to Zipkin using V2 API
- Jaeger: span 전송 to Jaeger's Collector
- periodic snapshot of telemetry data
1. Combined Reporters
- InfluxDB Reporter
kamon-influxdb- 고가용성 스토리지
- operation monitoring, application metrics, real-time analytics
libraryDepedencies += "io.kamon" %% "kamon-influxdb" %% "2.5.9"- 모든 메트릭 데이터를 http를 통해 influxDB에게 보냄.
- Kamon Metric 이름은 influxDB's "measurement-name"
- Counter ->
count - Gauges ->
value - Histogram/Range ->
count,sum,min,max,pXX(퍼센틸)
-
Play에 Kamon 설치
참고: https://kamon.io/docs/latest/instrumentation/play-framework/kamon-play-2.5- Context Propagation & Distributed tracing
- Client/Server HTTP Request Span은 자동으로 생성/전파, HTTP metric (
span.processing-time)도 생성
-
Kamon-Akka
참고: https://kamon.io/docs/latest/instrumentation/akka/kamon-akka-2.4- 메트릭 수집: 액터 시스템, 액터, 라우터, 디스패터, 액터그룹, 리모팅/클러스터 컴포넌트
- 메시지 트레이싱: span을 만들어 선택된 시스템 내 액터에서 process
- Context Propagation: actor message local-remote actor 전파
- Ask Pattern Timeout Warning: 애스크 타임아웃에 대한 경고
-
Kamon-Scala-Future
참고: https://kamon.io/docs/latest/instrumentation/futures/kamon-scala-future- 같은 Context를 Future 생성/map/flatMap 등에 적용되도 사용하도록
- body of future가
ExecutionContext내에서 돌아갈때, Kamon이 Context 캡쳐해서 이를 내부에서 사용할 수 있음. -
Kamon.span
- 주요 기능
- Span 생성: 코드 블록을 감싸고 그 안의 작업을 하나의 Span으로 만듭니다.
- 자동 시작 및 종료: Span은 블록이 시작될 때 자동으로 시작되고, 블록이 끝나면 자동으로 종료됩니다.
- 예외 처리: 블록 내에서 발생한 예외는 Span에 자동으로 기록됩니다.
- Context 저장: 생성된 Span은 현재 Context에 저장되어, 다른 Span과 연결될 수 있습니다.
- 주요 기능
-
Kamon-executors
참고: https://kamon.io/docs/latest/instrumentation/executors/kamon-executors- ExecutorService (ThreadPoolExecutor/ForkJoinPool) 에서 발생한 메트릭 수집
- Option: Tracking time in queue
- Collected Metrics
executor.threads.minexecutor.threads.maxexecutor.task.submittedexecutor.parallelism
-
Kamon-logback
참고: https://kamon.io/docs/latest/instrumentation/logback/kamon-logback- AsyncAppender 사용함에도 Context 보존
- 4개의 컨버터를 활용해 Context Information 도와줌
- TraceIDConverter: 현재 trace identifier를 내보냄, 없음
undefined - SpanIDConverter: 현재 span identifier를 내보냄, 없음
undefined - ContextTagConverter: 특정한 Context tag 내보냄.
- ContextEntryConverter: specified Context entry 내보냄
- TraceIDConverter: 현재 trace identifier를 내보냄, 없음
-
Kamon-elasticsearch
참고: https://kamon.io/docs/latest/instrumentation/elasticsearch/- 자동으로 span 생성해 Java Rest Client 보조