Elastic APM Agent 설정 (Java & Node.js)

이준섭·2023년 4월 3일

Elastic

목록 보기
3/3
post-thumbnail

1. Elastic APM Agent 설정

[Agent Download]
위 링크에서 해당 버전 Browse 클릭 후 jar파일 다운로드

[Java]
1. 루트 디렉토리에 agent 디렉토리 만들고 Elastic APM Agent 추가

2. agent 디렉토리에 profile 별 properties파일 만들기

service_name=<Application Service Name>
application_packages=<모니터링 packages>
server_url=<APM 서버 URL>
capture_headers=true
capture_body=all
sanitize_field_names=
environment=<profile>
  1. Application 실행 후 APM의 Services에 들어오는 지 확인
    [참조]
    https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html

[Node.js]
1. Elastic APM Agent을 npm install 한다.

npm install elastic-apm-node --save
  1. Root 디렉토리에 elastic-apm-node.js 파일 생성
module.exports = {
        serviceName: '<Service Name>',
        serverUrl: '<APM Server URL>',
        captureBody: 'all', -- request body 설정 부분
        sanitizeFieldNames: '', -- 공백으로 해야 Parameter 부분이 보임
        environment: 'dev' -- profile
    }
  1. 제일 먼저 실행 되는 js 혹은 ts 파일 맨 위에 해당 옵션 추가
require('elastic-apm-node').start({
  configFile: '/elastic-apm-node.js'
});

※ Node.js 애플리케이션의 경우 Kubernetes로 배포 되기 때문에 Configmap에
elastic-apm-node.js 파일을 생성하는 부분 작성해야함.
[참조]
https://www.elastic.co/guide/en/apm/agent/nodejs/current/configuring-the-agent.html#agent-configuration-object

0개의 댓글