1. Collector 구성하기

git clone https://github.com/pinpoint-apm/pinpoint-docker.git
cd pinpoint-docker
git checkout 2.5.3
docker-compose pull && docker-compose up -d
  • Collector로 사용할 EC2 생성 후, 위의 명령어로 collector, web, hbase 등을 구성합니다.

  • web의 포트번호 default는 8080 입니다.

  • docker-compose에서 pinpoint-agent, pinpoint-agent-attach-example, pinpoint-quickstart 등의 의존은 제거해도 됩니다.

2. Agent 구성하기

# infra-workshop/pinpoint-agent-2.5.3/pinpoint-root.config

profiler.transport.grpc.collector.ip=[Collector IP]

...

# 부하테스트 등 환경을 고려해서 샘플링을 고려
# eg. 1: 100%     20: 5%     50: 2%      100: 1%
profiler.sampling.counting.sampling-rate=1
# front 모듈 구동시 아래 옵션을 추가
-javaagent:pinpoint-agent-2.5.3/pinpoint-bootstrap-2.5.3.jar 
-Dpinpoint.agentId=front-api 
-Dpinpoint.applicationName=front-api
APM agent·collector·저장·web
APM agent·collector·저장·web요청 경로 · USER · front-api · -javaagent · agentId front-api · member-api · /api/auth/me · conference-api · servermap 노드 · 모니터링 경로(요청과 별도) · collector · gRPC [Collector IP] · HBase · 저장소 · web :8080 · Servermap · Callstack · Inspector · sampling-rate: 1 → 100% · 20 → 5% · 100 → 1%. 요청 경로와 모니터링 경로는 따로입니다(sampling-rate=1 → 100%).요청 경로USERfront-api-javaagent · agentId front-apimember-api/api/auth/meconference-apiservermap 노드모니터링 경로(요청과 별도)collectorgRPC [Collector IP] HBase저장소 web :8080Servermap · CallstackInspectorsampling-rate: 1 → 100% · 20 → 5% · 100 → 1%
APM agent·collector·저장·web요청 경로 · USER · front-api · -javaagent · agentId front-api · member-api · /api/auth/me · conference-api · servermap 노드 · 모니터링 경로(요청과 별도) · collector · gRPC [Collector IP] · HBase · 저장소 · web :8080 · Servermap · Callstack · Inspector · sampling-rate: 1 → 100% · 20 → 5% · 100 → 1%. 요청 경로와 모니터링 경로는 따로입니다(sampling-rate=1 → 100%).요청 경로USERfront-api-javaagent · agentId front-apimember-api/api/auth/meconference-apiservermap 노드모니터링 경로(요청과 별도)collectorgRPC [Collector IP] HBase저장소 web :8080Servermap · CallstackInspectorsampling-rate: 1 → 100% · 20 → 5% · 100 → 1%
과정 보기

1. USER 요청은 front-api를 거쳐 member-api로 갑니다.

APM agent·collector·저장·web · 1요청 경로 · USER · front-api · -javaagent · agentId front-api · member-api · /api/auth/me · conference-api · servermap 노드 · 모니터링 경로(요청과 별도) · collector · gRPC [Collector IP] · HBase · 저장소 · web :8080 · Servermap · Callstack · Inspector · sampling-rate: 1 → 100% · 20 → 5% · 100 → 1%. USER 요청이 front-api를 거쳐 member-api로 갑니다.요청 경로USERfront-api-javaagent · agentId front-apimember-api/api/auth/meconference-apiservermap 노드모니터링 경로(요청과 별도)collectorgRPC [Collector IP] HBase저장소 web :8080Servermap · CallstackInspectorsampling-rate: 1 → 100% · 20 → 5% · 100 → 1%
APM agent·collector·저장·web · 1요청 경로 · USER · front-api · -javaagent · agentId front-api · member-api · /api/auth/me · conference-api · servermap 노드 · 모니터링 경로(요청과 별도) · collector · gRPC [Collector IP] · HBase · 저장소 · web :8080 · Servermap · Callstack · Inspector · sampling-rate: 1 → 100% · 20 → 5% · 100 → 1%. USER 요청이 front-api를 거쳐 member-api로 갑니다.요청 경로USERfront-api-javaagent · agentId front-apimember-api/api/auth/meconference-apiservermap 노드모니터링 경로(요청과 별도)collectorgRPC [Collector IP] HBase저장소 web :8080Servermap · CallstackInspectorsampling-rate: 1 → 100% · 20 → 5% · 100 → 1%

2. agent는 요청과 별도로 span을 gRPC로 collector에 보내고, collector가 HBase에 씁니다.

APM agent·collector·저장·web · 2요청 경로 · USER · front-api · -javaagent · agentId front-api · member-api · /api/auth/me · conference-api · servermap 노드 · 모니터링 경로(요청과 별도) · collector · gRPC [Collector IP] · HBase · 저장소 · web :8080 · Servermap · Callstack · Inspector · sampling-rate: 1 → 100% · 20 → 5% · 100 → 1%. collector가 저장소(HBase)에 씁니다.요청 경로USERfront-api-javaagent · agentId front-apimember-api/api/auth/meconference-apiservermap 노드모니터링 경로(요청과 별도)collectorgRPC [Collector IP] HBase저장소 web :8080Servermap · CallstackInspectorsampling-rate: 1 → 100% · 20 → 5% · 100 → 1%
APM agent·collector·저장·web · 2요청 경로 · USER · front-api · -javaagent · agentId front-api · member-api · /api/auth/me · conference-api · servermap 노드 · 모니터링 경로(요청과 별도) · collector · gRPC [Collector IP] · HBase · 저장소 · web :8080 · Servermap · Callstack · Inspector · sampling-rate: 1 → 100% · 20 → 5% · 100 → 1%. collector가 저장소(HBase)에 씁니다.요청 경로USERfront-api-javaagent · agentId front-apimember-api/api/auth/meconference-apiservermap 노드모니터링 경로(요청과 별도)collectorgRPC [Collector IP] HBase저장소 web :8080Servermap · CallstackInspectorsampling-rate: 1 → 100% · 20 → 5% · 100 → 1%

3. web(8080)이 저장된 데이터로 Servermap·Callstack·Inspector를 보여 줍니다.

APM agent·collector·저장·web · 3요청 경로 · USER · front-api · -javaagent · agentId front-api · member-api · /api/auth/me · conference-api · servermap 노드 · 모니터링 경로(요청과 별도) · collector · gRPC [Collector IP] · HBase · 저장소 · web :8080 · Servermap · Callstack · Inspector · sampling-rate: 1 → 100% · 20 → 5% · 100 → 1%. 요청 경로와 모니터링 경로는 따로입니다(sampling-rate=1 → 100%).요청 경로USERfront-api-javaagent · agentId front-apimember-api/api/auth/meconference-apiservermap 노드모니터링 경로(요청과 별도)collectorgRPC [Collector IP] HBase저장소 web :8080Servermap · CallstackInspectorsampling-rate: 1 → 100% · 20 → 5% · 100 → 1%
APM agent·collector·저장·web · 3요청 경로 · USER · front-api · -javaagent · agentId front-api · member-api · /api/auth/me · conference-api · servermap 노드 · 모니터링 경로(요청과 별도) · collector · gRPC [Collector IP] · HBase · 저장소 · web :8080 · Servermap · Callstack · Inspector · sampling-rate: 1 → 100% · 20 → 5% · 100 → 1%. 요청 경로와 모니터링 경로는 따로입니다(sampling-rate=1 → 100%).요청 경로USERfront-api-javaagent · agentId front-apimember-api/api/auth/meconference-apiservermap 노드모니터링 경로(요청과 별도)collectorgRPC [Collector IP] HBase저장소 web :8080Servermap · CallstackInspectorsampling-rate: 1 → 100% · 20 → 5% · 100 → 1%

3. Pinpoint 웹 콘솔 살펴보기

A. Servermap

서버간 관계 및 트래픽 평균 응답시간, 응답 분포 등을 확인할 수 있습니다. 우측 상단의 응답시간 분포 영역을 마우스 드래그를 통해 특정 콜에 대한 추적이 가능합니다.

B. Callstack Trace

mixed view
mixed view

요청에 대한 소스레벨의 Trace View를 제공합니다. SQL 쿼리, 에러 로그 및 병목지점 등을 확인할 수 있고, 이를 Call Tree, Server Map 및 Mixed View 등으로 확인해 볼 수 있습니다.

호출 트리와 구간 시간
호출 트리와 구간 시간/api/conferences · 경과 시간(ms) · 0 · 200 · 400 · 600 · 800 · Servlet Process /api/conferences · 766 · self 10 · invoke (StandardHostValve) · 756 · self 27 · doPost (FrameworkServlet) · 729 · self 217 · getInputStream → :8084/api/auth/me · 510 · self 507 · [member-api] /api/auth/me · 448 · self 13 · invoke (StandardHostValve) · 435 · self 61 · doGet (FrameworkServlet) · 374 · self 101 · invokeWithinTransaction · 273 · self 253 · 403 · IOException · 500 · 실행 = self + 같은 앱 자식 · self 507 ms: 원격 응답 대기 포함 · 원격 span: 호출보다 5 ms 뒤 종료 · 하위 행 일부 생략. 보이는 행 기준(원본 표 아래는 잘림). 실행 = self + 자식./api/conferences · 경과 시간(ms)0200400600800Servlet Process /api/conferences766 · self 10invoke (StandardHostValve)756 · self 27doPost (FrameworkServlet)729 · self 217getInputStream → :8084/api/auth/me510 · self 507[member-api] /api/auth/me448 · self 13invoke (StandardHostValve)435 · self 61doGet (FrameworkServlet)374 · self 101invokeWithinTransaction273 · self 253403IOException500실행 = self + 같은 앱 자식 · self 507 ms: 원격 응답 대기 포함원격 span: 호출보다 5 ms 뒤 종료 · 하위 행 일부 생략
호출 트리와 구간 시간/api/conferences · 경과 시간(ms) · 0 · 200 · 400 · 600 · 800 · Servlet Process /api/conferences · 766 · self 10 · invoke (StandardHostValve) · 756 · self 27 · doPost (FrameworkServlet) · 729 · self 217 · getInputStream → :8084/api/auth/me · 510 · self 507 · [member-api] /api/auth/me · 448 · self 13 · invoke (StandardHostValve) · 435 · self 61 · doGet (FrameworkServlet) · 374 · self 101 · invokeWithinTransaction · 273 · self 253 · 403 · IOException · 500 · 실행 = self + 같은 앱 자식 · self 507 ms: 원격 응답 대기 포함 · 원격 span: 호출보다 5 ms 뒤 종료 · 하위 행 일부 생략. 보이는 행 기준(원본 표 아래는 잘림). 실행 = self + 자식./api/conferences · 경과 시간(ms)0200400600800Servlet Process /api/conferences766 · self 10invoke (StandardHostValve)756 · self 27doPost (FrameworkServlet)729 · self 217getInputStream → :8084/api/auth/me510 · self 507[member-api] /api/auth/me448 · self 13invoke (StandardHostValve)435 · self 61doGet (FrameworkServlet)374 · self 101invokeWithinTransaction273 · self 253403IOException500실행 = self + 같은 앱 자식 · self 507 ms: 원격 응답대기 포함원격 span: 호출보다 5 ms 뒤 종료 · 하위 행 일부 생략
과정 보기

1. 호출 순서대로 구간이 펼쳐지고, member-api span(448 ms)이 getInputStream(510 ms) 안에서 열립니다.

호출 트리와 구간 시간 · 1/api/conferences · 경과 시간(ms) · 0 · 200 · 400 · 600 · 800 · Servlet Process /api/conferences · 766 · self 10 · invoke (StandardHostValve) · 756 · self 27 · doPost (FrameworkServlet) · 729 · self 217 · getInputStream → :8084/api/auth/me · 510 · self 507 · [member-api] /api/auth/me · 448 · self 13 · invoke (StandardHostValve) · 435 · self 61 · doGet (FrameworkServlet) · 374 · self 101 · invokeWithinTransaction · 273 · self 253 · 실행 = self + 같은 앱 자식 · self 507 ms: 원격 응답 대기 포함 · 원격 span: 호출보다 5 ms 뒤 종료 · 하위 행 일부 생략. 호출 순서대로 구간이 펼쳐집니다. member-api span이 getInputStream 안에서 열립니다./api/conferences · 경과 시간(ms)0200400600800Servlet Process /api/conferences766 · self 10invoke (StandardHostValve)756 · self 27doPost (FrameworkServlet)729 · self 217getInputStream → :8084/api/auth/me510 · self 507[member-api] /api/auth/me448 · self 13invoke (StandardHostValve)435 · self 61doGet (FrameworkServlet)374 · self 101invokeWithinTransaction273 · self 253실행 = self + 같은 앱 자식 · self 507 ms: 원격 응답 대기 포함원격 span: 호출보다 5 ms 뒤 종료 · 하위 행 일부 생략
호출 트리와 구간 시간 · 1/api/conferences · 경과 시간(ms) · 0 · 200 · 400 · 600 · 800 · Servlet Process /api/conferences · 766 · self 10 · invoke (StandardHostValve) · 756 · self 27 · doPost (FrameworkServlet) · 729 · self 217 · getInputStream → :8084/api/auth/me · 510 · self 507 · [member-api] /api/auth/me · 448 · self 13 · invoke (StandardHostValve) · 435 · self 61 · doGet (FrameworkServlet) · 374 · self 101 · invokeWithinTransaction · 273 · self 253 · 실행 = self + 같은 앱 자식 · self 507 ms: 원격 응답 대기 포함 · 원격 span: 호출보다 5 ms 뒤 종료 · 하위 행 일부 생략. 호출 순서대로 구간이 펼쳐집니다. member-api span이 getInputStream 안에서 열립니다./api/conferences · 경과 시간(ms)0200400600800Servlet Process /api/conferences766 · self 10invoke (StandardHostValve)756 · self 27doPost (FrameworkServlet)729 · self 217getInputStream → :8084/api/auth/me510 · self 507[member-api] /api/auth/me448 · self 13invoke (StandardHostValve)435 · self 61doGet (FrameworkServlet)374 · self 101invokeWithinTransaction273 · self 253실행 = self + 같은 앱 자식 · self 507 ms: 원격 응답대기 포함원격 span: 호출보다 5 ms 뒤 종료 · 하위 행 일부 생략

2. 토큰 만료 → member-api 403 → front IOException → /api/conferences 500.

호출 트리와 구간 시간 · 2/api/conferences · 경과 시간(ms) · 0 · 200 · 400 · 600 · 800 · Servlet Process /api/conferences · 766 · self 10 · invoke (StandardHostValve) · 756 · self 27 · doPost (FrameworkServlet) · 729 · self 217 · getInputStream → :8084/api/auth/me · 510 · self 507 · [member-api] /api/auth/me · 448 · self 13 · invoke (StandardHostValve) · 435 · self 61 · doGet (FrameworkServlet) · 374 · self 101 · invokeWithinTransaction · 273 · self 253 · 403 · IOException · 500 · 실행 = self + 같은 앱 자식 · self 507 ms: 원격 응답 대기 포함 · 원격 span: 호출보다 5 ms 뒤 종료 · 하위 행 일부 생략. 병목이 아니라 오류 trace입니다. getInputStream self 507에는 원격 대기가 들어 있습니다./api/conferences · 경과 시간(ms)0200400600800Servlet Process /api/conferences766 · self 10invoke (StandardHostValve)756 · self 27doPost (FrameworkServlet)729 · self 217getInputStream → :8084/api/auth/me510 · self 507[member-api] /api/auth/me448 · self 13invoke (StandardHostValve)435 · self 61doGet (FrameworkServlet)374 · self 101invokeWithinTransaction273 · self 253403IOException500실행 = self + 같은 앱 자식 · self 507 ms: 원격 응답 대기 포함원격 span: 호출보다 5 ms 뒤 종료 · 하위 행 일부 생략
호출 트리와 구간 시간 · 2/api/conferences · 경과 시간(ms) · 0 · 200 · 400 · 600 · 800 · Servlet Process /api/conferences · 766 · self 10 · invoke (StandardHostValve) · 756 · self 27 · doPost (FrameworkServlet) · 729 · self 217 · getInputStream → :8084/api/auth/me · 510 · self 507 · [member-api] /api/auth/me · 448 · self 13 · invoke (StandardHostValve) · 435 · self 61 · doGet (FrameworkServlet) · 374 · self 101 · invokeWithinTransaction · 273 · self 253 · 403 · IOException · 500 · 실행 = self + 같은 앱 자식 · self 507 ms: 원격 응답 대기 포함 · 원격 span: 호출보다 5 ms 뒤 종료 · 하위 행 일부 생략. 병목이 아니라 오류 trace입니다. getInputStream self 507에는 원격 대기가 들어 있습니다./api/conferences · 경과 시간(ms)0200400600800Servlet Process /api/conferences766 · self 10invoke (StandardHostValve)756 · self 27doPost (FrameworkServlet)729 · self 217getInputStream → :8084/api/auth/me510 · self 507[member-api] /api/auth/me448 · self 13invoke (StandardHostValve)435 · self 61doGet (FrameworkServlet)374 · self 101invokeWithinTransaction273 · self 253403IOException500실행 = self + 같은 앱 자식 · self 507 ms: 원격 응답대기 포함원격 span: 호출보다 5 ms 뒤 종료 · 하위 행 일부 생략

3. getInputStream self 507 ms에는 원격 응답 대기가 들어 있습니다. member-api 안에서 가장 큰 self는 253 ms입니다.

호출 트리와 구간 시간 · 3/api/conferences · 경과 시간(ms) · 0 · 200 · 400 · 600 · 800 · Servlet Process /api/conferences · 766 · self 10 · invoke (StandardHostValve) · 756 · self 27 · doPost (FrameworkServlet) · 729 · self 217 · getInputStream → :8084/api/auth/me · 510 · self 507 · [member-api] /api/auth/me · 448 · self 13 · invoke (StandardHostValve) · 435 · self 61 · doGet (FrameworkServlet) · 374 · self 101 · invokeWithinTransaction · 273 · self 253 · 403 · IOException · 500 · 실행 = self + 같은 앱 자식 · self 507 ms: 원격 응답 대기 포함 · 원격 span: 호출보다 5 ms 뒤 종료 · 하위 행 일부 생략. 보이는 행 기준(원본 표 아래는 잘림). 실행 = self + 자식./api/conferences · 경과 시간(ms)0200400600800Servlet Process /api/conferences766 · self 10invoke (StandardHostValve)756 · self 27doPost (FrameworkServlet)729 · self 217getInputStream → :8084/api/auth/me510 · self 507[member-api] /api/auth/me448 · self 13invoke (StandardHostValve)435 · self 61doGet (FrameworkServlet)374 · self 101invokeWithinTransaction273 · self 253403IOException500실행 = self + 같은 앱 자식 · self 507 ms: 원격 응답 대기 포함원격 span: 호출보다 5 ms 뒤 종료 · 하위 행 일부 생략
호출 트리와 구간 시간 · 3/api/conferences · 경과 시간(ms) · 0 · 200 · 400 · 600 · 800 · Servlet Process /api/conferences · 766 · self 10 · invoke (StandardHostValve) · 756 · self 27 · doPost (FrameworkServlet) · 729 · self 217 · getInputStream → :8084/api/auth/me · 510 · self 507 · [member-api] /api/auth/me · 448 · self 13 · invoke (StandardHostValve) · 435 · self 61 · doGet (FrameworkServlet) · 374 · self 101 · invokeWithinTransaction · 273 · self 253 · 403 · IOException · 500 · 실행 = self + 같은 앱 자식 · self 507 ms: 원격 응답 대기 포함 · 원격 span: 호출보다 5 ms 뒤 종료 · 하위 행 일부 생략. 보이는 행 기준(원본 표 아래는 잘림). 실행 = self + 자식./api/conferences · 경과 시간(ms)0200400600800Servlet Process /api/conferences766 · self 10invoke (StandardHostValve)756 · self 27doPost (FrameworkServlet)729 · self 217getInputStream → :8084/api/auth/me510 · self 507[member-api] /api/auth/me448 · self 13invoke (StandardHostValve)435 · self 61doGet (FrameworkServlet)374 · self 101invokeWithinTransaction273 · self 253403IOException500실행 = self + 같은 앱 자식 · self 507 ms: 원격 응답대기 포함원격 span: 호출보다 5 ms 뒤 종료 · 하위 행 일부 생략

C. Inspector

CPU, memory, tps, datasource connection count 등 agent 들의 리소스 지표를 확인할 수 있습니다.