본문 바로가기

Monitoring Tools/Pinpoint

17. pinpoint | Nginx Http Header 추가

반응형

1. Nginx → Tomcat 으로 보낼때 pinpoint가 해석 가능한 헤더에 시간값을 넣어줌으로서 Delay 계산 가능

 

2. tomcat pinpoint agent에 아래 내용 적용(default로 enable)

##pinpoint.config
 
profiler.proxy.http.header.enable=true

 

3. Nginx 적용

server {
server_name {domain};
location / {
proxy_buffering on;
proxy_buffer_size 128k;
proxy_buffers 8 128k;
access_log /var/log/nginx/access.log main2;
 
## pinpoint-monitor
set $pinpoint_proxy_header "t=$msec D=$request_time";
proxy_set_header Pinpoint-ProxyNginx $pinpoint_proxy_header;
 
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:2020;
index index.jsp;
}
}
반응형