본문으로 건너뛰기

Java Agent 파라미터 (고급편)

Java Agent P2/P3 고급 파라미터 레퍼런스

기본 파라미터(P0/P1)는 10-1.agent-java-params.md 참조.


3. 프로파일링 고급 (Profiling Advanced)

트랜잭션 내부의 SQL, HTTP, 메서드 호출 등 상세 스텝을 기록하는 고급 파라미터이다. 버퍼 순환 및 Stuck 강제 종료 동작 원리는 10-1.agent-java-params.md를 참조한다.

파라미터 테이블

파라미터타입기본값conf 키중요도설명
profile_http_header_enabledbooleanfalseprofile_http_header_enabled고급HTTP 요청 헤더를 프로파일에 기록한다.
profile_http_header_url_prefixString""profile_http_header_url_prefix고급특정 URL prefix에만 HTTP 헤더를 기록한다. 빈 값이면 전체 URL 대상이다.
profile_http_parameter_enabledbooleanfalseprofile_http_parameter_enabled고급HTTP 요청 파라미터를 프로파일에 기록한다. 민감 데이터 노출에 주의한다.
profile_http_querystring_enabledbooleanfalseprofile_http_querystring_enabled고급HTTP 쿼리 스트링을 프로파일에 기록한다.
profile_connection_open_enabledbooleantrueprofile_connection_open_enabled고급JDBC Connection open 이벤트를 프로파일에 기록한다.
profile_connection_close_enabledbooleanfalseprofile_connection_close_enabled참조JDBC Connection close 이벤트를 프로파일에 기록한다.
profile_connection_autocommit_status_enabledbooleanfalseprofile_connection_autocommit_status_enabled참조JDBC Connection autocommit 상태를 프로파일에 기록한다.
profile_method_enabledbooleantrueprofile_method_enabled고급메서드 프로파일링 활성화. hook_method_patterns와 함께 동작한다.
profile_sql_escape_enabledbooleantrueprofile_sql_escape_enabled고급SQL 파라미터 바인딩 시 이스케이프 처리를 수행한다. XSS 방지 목적이다.
profile_fullstack_enabledbooleanfalseprofile_fullstack_enabled고급전체 스택 트레이스를 프로파일에 포함한다. 디버깅 시 일시적으로 활성화한다.
profile_fullstack_max_linesint0profile_fullstack_max_lines참조전체 스택 트레이스 최대 라인 수. 0이면 제한 없음이다.
profile_fullstack_hooked_exception_enabledbooleanfalseprofile_fullstack_hooked_exception_enabled참조Hook된 예외에 대해 전체 스택 트레이스를 기록한다.
profile_fullstack_rs_leak_enabledbooleanfalseprofile_fullstack_rs_leak_enabled참조ResultSet 누수 감지 시 전체 스택 트레이스를 기록한다.
profile_fullstack_stmt_leak_enabledbooleanfalseprofile_fullstack_stmt_leak_enabled참조Statement 누수 감지 시 전체 스택 트레이스를 기록한다.
profile_force_end_stuck_alertbooleantrueprofile_force_end_stuck_alert고급스턱 서비스 강제 종료 시 Alert을 전송한다.
profile_force_end_stuck_with_interruptbooleanfalseprofile_force_end_stuck_with_interrupt고급스턱 서비스 강제 종료 시 Thread.interrupt()를 호출한다. 부작용에 주의한다.
profile_elasticsearch_enabledbooleantrueprofile_elasticsearch_enabled고급Elasticsearch 호출을 프로파일에 기록한다.
profile_reactor_first_backpressure_enabledbooleantrueprofile_reactor_first_backpressure_enabled참조Reactor 첫 번째 backpressure 이벤트를 프로파일에 기록한다.
profile_redis_enabledbooleantrueprofile_redis_enabled고급Redis 호출을 프로파일에 기록한다.
profile_connection_open_fullstack_enabledbooleanfalseprofile_connection_open_fullstack_enabled참조Connection open 시 전체 스택 트레이스를 기록한다. Connection Pool 문제 진단에 사용한다.
profile_connection_open_fullstack_trim_enabledbooleantrueprofile_connection_open_fullstack_trim_enabled참조Connection open 스택 트레이스에서 프레임워크 내부 프레임을 생략한다.
profile_sql_param_lengthint40profile_sql_param_length고급SQL 바인드 파라미터 최대 표시 길이. 긴 파라미터는 잘린다.
profile_method_time_threshold_msint0profile_method_time_threshold_ms고급메서드 프로파일링 최소 실행 시간(ms). 이 값 미만이면 프로파일에서 제외한다. 0이면 전체 기록이다.
profile_http_header_keysString""profile_http_header_keys고급프로파일에 기록할 HTTP 헤더 키 목록 (콤마 구분). 빈 값이면 전체 헤더를 기록한다.
profile_http_parameter_url_prefixString""profile_http_parameter_url_prefix참조특정 URL prefix에만 HTTP 파라미터를 기록한다.
profile_dbc_close_enabledbooleanfalseprofile_dbc_close_enabled참조DB Connection close 이벤트 프로파일링 활성화이다.
profile_rs_leak_enabledbooleanfalseprofile_rs_leak_enabled참조ResultSet 누수 감지를 활성화한다.
profile_stmt_leak_enabledbooleanfalseprofile_stmt_leak_enabled참조Statement 누수 감지를 활성화한다.
profile_thread_cputime_enabledbooleanfalseprofile_thread_cputime_enabled고급스레드 CPU 시간을 프로파일에 기록한다. 약간의 오버헤드가 있다.
profile_block_servlet_enabledbooleanfalseprofile_block_servlet_enabled참조특정 서블릿에 대한 블록 프로파일링을 활성화한다.
profile_spring_controller_method_parameter_enabledbooleanfalseprofile_spring_controller_method_parameter_enabled고급Spring Controller 메서드 파라미터를 프로파일에 기록한다.
profile_resultset_fetch_enabledbooleanfalseprofile_resultset_fetch_enabled참조ResultSet fetch 이벤트를 프로파일에 기록한다.
profile_api_call_header_enabledbooleanfalseprofile_api_call_header_enabled참조API 호출 시 HTTP 헤더를 프로파일에 기록한다.

연관 관계

profile_http_header_enabled ──┐
profile_http_header_url_prefix ──┤── HTTP 헤더 프로파일링 그룹
profile_http_header_keys ────────┘

profile_http_parameter_enabled ──┐
profile_http_parameter_url_prefix ──┘── HTTP 파라미터 프로파일링 그룹

profile_connection_open_enabled ──┐
profile_connection_open_fullstack_enabled ──┤── Connection 프로파일링 그룹
profile_connection_open_fullstack_trim_enabled ──┤
profile_connection_close_enabled ──┤
profile_connection_autocommit_status_enabled ──┘

profile_force_end_stuck_alert ──┐
profile_force_end_stuck_with_interrupt ──┘── Stuck 서비스 제어 그룹 (P1 profile_force_end_stuck_millis와 연동)

profile_fullstack_enabled ──┐
profile_fullstack_max_lines ──┤── 전체 스택 트레이스 그룹
profile_fullstack_hooked_exception_enabled ──┤
profile_fullstack_rs_leak_enabled ──┤
profile_fullstack_stmt_leak_enabled ──┘

profile_method_enabled ──┐
profile_method_time_threshold_ms ──┘── 메서드 프로파일링 그룹 (hook_method_patterns 연동)

4. 트레이싱 고급 (Tracing Advanced)

분산 트레이싱, 사용자 식별 세부, URL 정규화 등 고급 트레이싱 파라미터이다. Active Thread 3색 분류 및 trace_user_mode 동작 원리는 10-1.agent-java-params.md를 참조한다.

파라미터 테이블

파라미터타입기본값conf 키중요도설명
trace_user_session_keyString""trace_user_session_key고급trace_user_mode=1 시 사용할 세션 쿠키 이름. 빈 값이면 JSESSIONID를 사용한다.
trace_user_cookie_pathString"/"trace_user_cookie_path참조trace_user_mode=2 시 FlowKat 쿠키의 Path 속성이다.
trace_flowkat_cookie_max_ageintInteger.MAX_VALUEtrace_flowkat_cookie_max_age참조trace_user_mode=2 시 FlowKat 쿠키 Max-Age(초). 기본 Integer.MAX_VALUE(사실상 무기한)이다.
trace_interservice_enabledbooleantruetrace_interservice_enabled고급인터서비스 트레이싱 활성화. 서비스 간 호출 연결 추적에 사용한다.
trace_propagete_b3_headerbooleantruetrace_propagete_b3_header고급B3 헤더 전파 활성화. 주의: **propagete**는 의도된 키명이다. **propagate**로 변경하면 적용되지 않는다.
trace_http_client_ip_header_keyString""trace_http_client_ip_header_key고급클라이언트 IP 추출에 사용할 HTTP 헤더 키. 프록시/LB 환경에서 X-Forwarded-For 등을 지정한다.
trace_service_name_header_keyString""trace_service_name_header_key고급서비스 이름을 HTTP 헤더에서 추출한다. API Gateway 환경에서 유용하다.
trace_service_name_get_keyString""trace_service_name_get_key참조서비스 이름을 GET 파라미터에서 추출한다.
trace_service_name_post_keyString""trace_service_name_post_key참조서비스 이름을 POST 파라미터에서 추출한다.
trace_request_queuing_enabledbooleanfalsetrace_request_queuing_enabled고급Request Queuing 시간 추적 활성화. LB/Proxy 대기 시간을 측정한다.
trace_request_queuing_start_host_headerString""trace_request_queuing_start_host_header참조Request Queuing 시작 시점을 담은 호스트 헤더 키이다.
trace_background_socket_enabledbooleantruetrace_background_socket_enabled고급백그라운드 소켓 트레이싱 활성화이다.
trace_db2_enabledbooleanfalsetrace_db2_enabled참조DB2 전용 트레이싱 활성화이다.
trace_sql_parameter_max_lengthint40trace_sql_parameter_max_length고급SQL 바인드 파라미터 최대 표시 길이이다.
trace_interservice_caller_header_enabledbooleantruetrace_interservice_caller_header_enabled참조인터서비스 호출 시 caller 헤더 전송을 활성화한다.
trace_interservice_callee_header_enabledbooleantruetrace_interservice_callee_header_enabled참조인터서비스 호출 시 callee 헤더 수신을 활성화한다.
trace_response_gxid_enabledbooleanfalsetrace_response_gxid_enabled참조응답 헤더에 GXID(글로벌 트랜잭션 ID)를 포함한다.
trace_normalize_enabledbooleantruetrace_normalize_enabled고급URL 정규화 활성화. RESTful URL의 가변 경로를 *로 치환한다.
trace_normalize_urlsString""trace_normalize_urls고급수동 정규화 URL 패턴 목록 (콤마 구분)이다.

연관 관계

trace_user_session_key ──┐
trace_user_cookie_path ──┤── 사용자 식별 세부 그룹 (P1 trace_user_mode와 연동)
trace_flowkat_cookie_max_age ──┤
trace_http_client_ip_header_key ──┘

trace_interservice_enabled ──┐
trace_interservice_caller_header_enabled ──┤── 분산 트레이싱 그룹
trace_interservice_callee_header_enabled ──┤
trace_propagete_b3_header ──┤
trace_response_gxid_enabled ──┘

trace_service_name_header_key ──┐
trace_service_name_get_key ─────┤── 서비스 이름 추출 그룹
trace_service_name_post_key ────┘

trace_request_queuing_enabled ──┐
trace_request_queuing_start_host_header ──┘── Request Queuing 그룹

5. XLog 에러 마킹 고급

XLog 에러 마킹의 P2 파라미터이다. P1 파라미터 및 동작 원리는 10-1.agent-java-params.md를 참조한다.

파라미터 테이블

파라미터타입기본값conf 키중요도설명
xlog_error_check_user_transaction_enabledbooleantruexlog_error_check_user_transaction_enabled고급사용자 트랜잭션(UserTransaction)에서 발생한 에러도 XLog에 마킹한다.
xlog_error_on_sqlexception_enabledbooleantruexlog_error_on_sqlexception_enabled고급SQLException 발생 시 XLog에 에러를 마킹한다.
xlog_error_on_apicall_exception_enabledbooleantruexlog_error_on_apicall_exception_enabled고급API 호출 예외 시 XLog에 에러를 마킹한다.
xlog_error_on_redis_exception_enabledbooleantruexlog_error_on_redis_exception_enabled고급Redis 예외 시 XLog에 에러를 마킹한다.
xlog_error_on_mongodb_exception_enabledbooleantruexlog_error_on_mongodb_exception_enabled고급MongoDB 예외 시 XLog에 에러를 마킹한다.
xlog_error_on_elasticsearch_exception_enabledbooleantruexlog_error_on_elasticsearch_exception_enabled고급Elasticsearch 예외 시 XLog에 에러를 마킹한다.
xlog_error_off_http_status_regexString""xlog_error_off_http_status_regex고급이 정규식에 매칭되는 HTTP 상태 코드는 에러로 마킹하지 않는다. 예: `"404
xlog_error_off_message_regexString""xlog_error_off_message_regex고급이 정규식에 매칭되는 에러 메시지는 에러로 마킹하지 않는다. 비즈니스 예외 제외 시 사용한다.

6. XLog 샘플링 (Global)

고트래픽 환경에서 XLog 데이터량을 제어하기 위한 글로벌 샘플링 파라미터이다. 응답 시간 구간별로 샘플링 비율을 차등 적용하여, 빠른 트랜잭션은 일부만 수집하고 느린 트랜잭션은 전량 수집하는 전략이다.

파라미터 테이블

파라미터타입기본값conf 키중요도설명
xlog_sampling_enabledbooleanfalsexlog_sampling_enabled고급XLog 샘플링 활성화. 비활성화 시 전량 수집한다.
xlog_sampling_rate_precisionint1xlog_sampling_rate_precision참조샘플링 비율 정밀도. 1=1% 단위, 10=0.1% 단위, 100=0.01% 단위이다.
xlog_sampling_only_profilebooleanfalsexlog_sampling_only_profile고급true이면 프로파일 데이터만 샘플링하고, XLog 자체(TPS/요약)는 전량 유지한다.
xlog_sampling_step1_msint100xlog_sampling_step1_ms고급1단계 응답시간 기준(ms). 이 값 미만인 트랜잭션에 step1_rate_pct를 적용한다.
xlog_sampling_step1_rate_pctint3xlog_sampling_step1_rate_pct고급1단계 샘플링 비율(%). 기본 3% — 100ms 미만 빠른 트랜잭션의 3%만 수집한다.
xlog_sampling_step2_msint1000xlog_sampling_step2_ms고급2단계 응답시간 기준(ms).
xlog_sampling_step2_rate_pctint10xlog_sampling_step2_rate_pct고급2단계 샘플링 비율(%).
xlog_sampling_step3_msint3000xlog_sampling_step3_ms고급3단계 응답시간 기준(ms).
xlog_sampling_step3_rate_pctint30xlog_sampling_step3_rate_pct고급3단계 샘플링 비율(%).
xlog_sampling_over_rate_pctint100xlog_sampling_over_rate_pct고급4단계(step3 초과) 샘플링 비율(%). 기본 100% — 느린 트랜잭션 전량 수집이다.
xlog_sampling_exclude_patternsString""xlog_sampling_exclude_patterns고급샘플링에서 제외할 서비스 패턴 (콤마 구분). 매칭되는 서비스는 항상 전량 수집한다.
ignore_global_consequent_samplingbooleanfalseignore_global_consequent_sampling참조글로벌 연쇄 샘플링을 무시한다. 인터서비스 호출 시 caller의 샘플링 결정을 callee가 따르지 않는다.
xlog_consequent_sampling_ignore_patternsString""xlog_consequent_sampling_ignore_patterns참조연쇄 샘플링 무시 패턴. 특정 서비스에서만 연쇄 샘플링을 무시한다.

동작 원리: 4단계 응답시간 기반 샘플링

[4단계 응답시간 기반 샘플링 알고리즘]

function should_sample(elapsed_ms):
if NOT xlog_sampling_enabled:
return KEEP // 샘플링 비활성화 → 전량 수집

// 1. 응답시간 구간별 샘플링 비율 결정
if elapsed_ms < xlog_sampling_step1_ms: // < 100ms
rate_pct = xlog_sampling_step1_rate_pct // 3%
else if elapsed_ms < xlog_sampling_step2_ms: // < 1000ms
rate_pct = xlog_sampling_step2_rate_pct // 10%
else if elapsed_ms < xlog_sampling_step3_ms: // < 3000ms
rate_pct = xlog_sampling_step3_rate_pct // 30%
else: // >= 3000ms
rate_pct = xlog_sampling_over_rate_pct // 100%

// 2. 제외 패턴 체크
if service_name matches xlog_sampling_exclude_patterns:
return KEEP // 패턴 매칭 → 항상 수집

// 3. 랜덤 결정
precision = xlog_sampling_rate_precision // 1
random_value = random() % (100 * precision) // 0 ~ 99
threshold = rate_pct // 3

if random_value >= threshold:
return DISCARD // 버림
else:
return KEEP // 수집

// 4. xlog_sampling_only_profile == true 인 경우
// DISCARD된 트랜잭션도 XLog 요약(TPS, 응답시간)은 유지하고
// 프로파일 데이터(SQL, 메서드 스텝)만 버린다

[기본값 적용 시 샘플링 비율 요약]

응답 시간 | 샘플링 비율 | 수집 비율
< 100ms | 3% | 100건 중 3건 수집
100ms ~ 1s | 10% | 100건 중 10건 수집
1s ~ 3s | 30% | 100건 중 30건 수집
>= 3s | 100% | 전량 수집

[정밀도 예시: rate_precision=10]

rate_pct=3 → random % 1000 >= 3 이면 DISCARD → 실제 수집률 0.3%
rate_pct=30 → random % 1000 >= 30 이면 DISCARD → 실제 수집률 3.0%

설정 예시

# 시나리오 1: 기본 샘플링 (고트래픽 웹 서비스)
xlog_sampling_enabled=true
# 기본값 사용: step1=100ms/3%, step2=1s/10%, step3=3s/30%, over=100%

# 시나리오 2: 공격적 샘플링 (초대용량 트래픽, 10만 TPS 이상)
xlog_sampling_enabled=true
xlog_sampling_step1_rate_pct=1
xlog_sampling_step2_rate_pct=5
xlog_sampling_step3_rate_pct=20
xlog_sampling_over_rate_pct=100
xlog_sampling_only_profile=true

# 시나리오 3: 특정 서비스 제외 (헬스체크는 항상 수집)
xlog_sampling_enabled=true
xlog_sampling_exclude_patterns=/health*,/actuator*

# 시나리오 4: 0.1% 정밀도 샘플링
xlog_sampling_enabled=true
xlog_sampling_rate_precision=10
xlog_sampling_step1_rate_pct=5 # 실제 0.5% 수집

7. XLog 패턴 샘플링 (Groups 1-5)

서비스 이름 패턴별로 개별 샘플링 비율을 적용하는 파라미터이다. 5개 그룹을 지원하며, 그룹 1부터 5까지 순서대로 평가하여 첫 번째 매칭 그룹의 설정을 적용한다. 어떤 그룹에도 매칭되지 않으면 글로벌 샘플링(섹션 6)으로 폴백한다.

파라미터 테이블 (그룹 1 대표)

그룹 2~5는 접두사만 다르며 동일한 구조이다: xlog_patterned2_sampling_*, xlog_patterned3_sampling_*, xlog_patterned4_sampling_*, xlog_patterned5_sampling_*

파라미터타입기본값conf 키중요도설명
xlog_patterned_sampling_enabledbooleanfalsexlog_patterned_sampling_enabled고급그룹 1 패턴 샘플링 활성화이다.
xlog_patterned_sampling_service_patternsString""xlog_patterned_sampling_service_patterns고급그룹 1 매칭 서비스 패턴 (콤마 구분). 와일드카드 * 지원한다.
xlog_patterned_sampling_rate_precisionint1xlog_patterned_sampling_rate_precision참조그룹 1 샘플링 정밀도이다.
xlog_patterned_sampling_only_profilebooleanfalsexlog_patterned_sampling_only_profile참조그룹 1 프로파일만 샘플링이다.
xlog_patterned_sampling_step1_msint100xlog_patterned_sampling_step1_ms고급그룹 1 1단계 응답시간 기준(ms)이다.
xlog_patterned_sampling_step1_rate_pctint3xlog_patterned_sampling_step1_rate_pct고급그룹 1 1단계 샘플링 비율(%)이다.
xlog_patterned_sampling_step2_msint1000xlog_patterned_sampling_step2_ms고급그룹 1 2단계 응답시간 기준(ms)이다.
xlog_patterned_sampling_step2_rate_pctint10xlog_patterned_sampling_step2_rate_pct고급그룹 1 2단계 샘플링 비율(%)이다.
xlog_patterned_sampling_step3_msint3000xlog_patterned_sampling_step3_ms고급그룹 1 3단계 응답시간 기준(ms)이다.
xlog_patterned_sampling_step3_rate_pctint30xlog_patterned_sampling_step3_rate_pct고급그룹 1 3단계 샘플링 비율(%)이다.
xlog_patterned_sampling_over_rate_pctint100xlog_patterned_sampling_over_rate_pct고급그룹 1 4단계(step3 초과) 샘플링 비율(%)이다.

그룹 2~5 접두사 매핑:

그룹conf 키 접두사예시
그룹 1xlog_patterned_sampling_xlog_patterned_sampling_enabled
그룹 2xlog_patterned2_sampling_xlog_patterned2_sampling_enabled
그룹 3xlog_patterned3_sampling_xlog_patterned3_sampling_enabled
그룹 4xlog_patterned4_sampling_xlog_patterned4_sampling_enabled
그룹 5xlog_patterned5_sampling_xlog_patterned5_sampling_enabled

동작 원리: 패턴 매칭 우선순위

[패턴 샘플링 평가 알고리즘]

function evaluate_sampling(service_name, elapsed_ms):

// 1. 패턴 그룹 순차 평가 (1 → 2 → 3 → 4 → 5)
for group_id in [1, 2, 3, 4, 5]:
config = get_patterned_config(group_id)

if NOT config.enabled:
continue // 비활성화 그룹 건너뜀

if match(service_name, config.service_patterns):
// 첫 번째 매칭 그룹의 설정으로 샘플링 결정
return apply_sampling(elapsed_ms, config)

// 2. 어떤 그룹에도 매칭되지 않으면 글로벌 샘플링 적용
return apply_global_sampling(elapsed_ms)

[패턴 매칭 규칙]
- 와일드카드 `*` 지원: `/api/order*` → `/api/order`, `/api/order/detail` 모두 매칭
- 콤마로 다중 패턴: `/api/order*,/api/payment*`
- 대소문자 구분함
- 첫 번째 매칭 그룹에서 결정 → 나머지 그룹은 평가하지 않음

[우선순위 활용 예시]
그룹 1: /health*,/actuator* → 0% 수집 (완전 제외)
그룹 2: /api/batch* → step1=1s/1%, step2=5s/10%, step3=10s/50%
그룹 3: /api/realtime* → 전량 수집 (100%)
나머지: 글로벌 샘플링 기본값 적용

설정 예시

# 그룹 1: 헬스체크/액추에이터 — 완전 제외
xlog_patterned_sampling_enabled=true
xlog_patterned_sampling_service_patterns=/health*,/actuator*,/favicon.ico
xlog_patterned_sampling_step1_rate_pct=0
xlog_patterned_sampling_step2_rate_pct=0
xlog_patterned_sampling_step3_rate_pct=0
xlog_patterned_sampling_over_rate_pct=0

# 그룹 2: 배치 API — 느슨한 기준
xlog_patterned2_sampling_enabled=true
xlog_patterned2_sampling_service_patterns=/api/batch*,/api/report*
xlog_patterned2_sampling_step1_ms=1000
xlog_patterned2_sampling_step1_rate_pct=1
xlog_patterned2_sampling_step2_ms=5000
xlog_patterned2_sampling_step2_rate_pct=10
xlog_patterned2_sampling_step3_ms=10000
xlog_patterned2_sampling_step3_rate_pct=50
xlog_patterned2_sampling_over_rate_pct=100

# 그룹 3: 핵심 거래 API — 전량 수집
xlog_patterned3_sampling_enabled=true
xlog_patterned3_sampling_service_patterns=/api/payment*,/api/order*
xlog_patterned3_sampling_step1_rate_pct=100
xlog_patterned3_sampling_step2_rate_pct=100
xlog_patterned3_sampling_step3_rate_pct=100
xlog_patterned3_sampling_over_rate_pct=100

# 글로벌 샘플링 (그룹 미매칭 트랜잭션에 적용)
xlog_sampling_enabled=true

8. XLog 디스카드

특정 서비스의 XLog를 완전히 버리는 파라미터이다. 샘플링과 달리 비율이 아닌 패턴 매칭으로 동작하며, 매칭된 서비스의 데이터를 전량 제거한다.

파라미터 테이블

파라미터타입기본값conf 키중요도설명
xlog_discard_service_patternsString""xlog_discard_service_patterns고급부분 디스카드 패턴 (콤마 구분). 매칭 서비스의 XLog와 프로파일은 버리지만, TPS/응답시간 요약 데이터는 유지한다.
xlog_fully_discard_service_patternsString""xlog_fully_discard_service_patterns고급완전 디스카드 패턴 (콤마 구분). 매칭 서비스의 모든 데이터(XLog, 프로파일, TPS, 요약)를 완전히 제거한다.
xlog_discard_service_show_errorbooleantruexlog_discard_service_show_error참조디스카드 대상이라도 에러 트랜잭션은 XLog에 표시한다. xlog_discard_service_patterns에만 적용된다.

동작 원리

[XLog 디스카드 판정 흐름]

function check_discard(service_name, is_error):

// 1. 완전 디스카드 (최우선)
if match(service_name, xlog_fully_discard_service_patterns):
return FULLY_DISCARD
// XLog: 버림
// Profile: 버림
// TPS/Summary: 버림 (카운터에서 완전 제외)

// 2. 부분 디스카드
if match(service_name, xlog_discard_service_patterns):
if is_error AND xlog_discard_service_show_error:
return KEEP // 에러 트랜잭션은 유지
return PARTIAL_DISCARD
// XLog: 버림
// Profile: 버림
// TPS/Summary: 유지 (카운터에는 포함)

// 3. 디스카드 대상 아님
return KEEP

[디스카드 vs 샘플링 비교]

| 구분 | 디스카드 | 샘플링 |
|------|---------|--------|
| 대상 선정 | 패턴 매칭 (전량) | 응답시간 + 확률 |
| TPS 영향 | partial=유지, full=제거 | 항상 유지 |
| 에러 보존 | partial=가능, full=불가 | 불가 |
| 용도 | 불필요한 서비스 제거 | 데이터량 조절 |

[평가 순서]
fully_discard → discard → patterned sampling (1~5) → global sampling

9. Hook/계측 (Instrumentation)

바이트코드 위빙을 통해 대상 클래스/메서드를 계측하는 파라미터이다. Hook 패턴 변경 후에는 JVM 재시작이 필요하다. P1 파라미터 hook_method_patterns10-1.agent-java-params.md를 참조한다.

파라미터 테이블 (사용자 설정 가능 항목만)

파라미터타입기본값conf 키중요도설명
hook_method_ignore_prefixesString""hook_method_ignore_prefixes고급Hook 제외 메서드 접두사. 프레임워크 내부 메서드 제외에 사용한다.
hook_method_ignore_classesString""hook_method_ignore_classes고급Hook 제외 클래스. 프록시/자동생성 클래스 제외에 사용한다.
hook_method_access_public_enabledbooleantruehook_method_access_public_enabled고급public 메서드 Hook 활성화이다.
hook_method_access_private_enabledbooleanfalsehook_method_access_private_enabled참조private 메서드 Hook 활성화이다.
hook_method_access_protected_enabledbooleanfalsehook_method_access_protected_enabled참조protected 메서드 Hook 활성화이다.
hook_method_access_none_enabledbooleanfalsehook_method_access_none_enabled참조package-private 메서드 Hook 활성화이다.
hook_method_lambda_enablebooleantruehook_method_lambda_enable고급Lambda 표현식 Hook 활성화이다.
hook_method_anonymous_enablebooleantruehook_method_anonymous_enable고급익명 클래스 메서드 Hook 활성화이다.
hook_service_patternsString""hook_service_patterns고급서비스 진입점 Hook 패턴. Servlet 외 진입점을 지정한다.
hook_apicall_patternsString""hook_apicall_patterns고급API 호출 Hook 패턴. HttpClient, RestTemplate 등 외부 호출을 추적한다.
hook_apicall_info_patternsString""hook_apicall_info_patterns참조API 호출 정보 Hook 패턴. 호출 URL/파라미터를 추출한다.
hook_jsp_patternsString""hook_jsp_patterns참조JSP Hook 패턴이다.
hook_servlet_classString""hook_servlet_class고급서블릿 클래스 직접 지정. 자동 감지가 안 되는 환경에서 사용한다.
hook_args_patternsString""hook_args_patterns고급메서드 인자를 프로파일에 기록할 패턴이다.
hook_return_patternsString""hook_return_patterns고급메서드 리턴값을 프로파일에 기록할 패턴이다.
hook_constructor_patternsString""hook_constructor_patterns참조생성자 Hook 패턴이다.
hook_connection_open_patternsString""hook_connection_open_patterns고급JDBC Connection open Hook 패턴이다.
hook_get_connection_patternsString""hook_get_connection_patterns고급DataSource.getConnection() Hook 패턴이다.
hook_jdbc_pstmt_classesString""hook_jdbc_pstmt_classes고급JDBC PreparedStatement 구현 클래스 직접 지정이다.
hook_jdbc_stmt_classesString""hook_jdbc_stmt_classes고급JDBC Statement 구현 클래스 직접 지정이다.
hook_jdbc_rs_classesString""hook_jdbc_rs_classes고급JDBC ResultSet 구현 클래스 직접 지정이다.
hook_jdbc_wrapping_driver_patternsString""hook_jdbc_wrapping_driver_patterns참조JDBC Driver 래핑 패턴이다.
hook_jdbc_oracle_cstat_capture_enabledbooleanfalsehook_jdbc_oracle_cstat_capture_enabled참조Oracle CallableStatement 캡처 활성화이다.
hook_exception_class_patternsString""hook_exception_class_patterns고급예외 Hook 클래스 패턴이다.
hook_exception_exclude_class_patternsString""hook_exception_exclude_class_patterns고급예외 Hook 제외 클래스 패턴이다.
hook_exception_handler_method_patternsString""hook_exception_handler_method_patterns참조예외 핸들러 메서드 Hook 패턴이다.
hook_exception_handler_exclude_class_patternsString""hook_exception_handler_exclude_class_patterns참조예외 핸들러 제외 클래스 패턴이다.
hook_async_callrunnable_enabledbooleantruehook_async_callrunnable_enabled고급비동기 Callable/Runnable Hook 활성화이다.
hook_async_callrunnable_scan_package_prefixesString""hook_async_callrunnable_scan_package_prefixes고급비동기 Hook 스캔 대상 패키지 접두사이다.
hook_async_thread_pool_executor_enabledbooleanfalsehook_async_thread_pool_executor_enabled참조ThreadPoolExecutor Hook 활성화이다.
hook_spring_async_enabledbooleanfalsehook_spring_async_enabled고급Spring @Async Hook 활성화이다.
hook_spring_async_submit_patternsString""hook_spring_async_submit_patterns참조Spring Async submit 메서드 패턴이다.
hook_hystrix_enabledbooleanfalsehook_hystrix_enabled참조Hystrix Command Hook 활성화이다.
hook_scouter_weaver_enabledbooleantruehook_scouter_weaver_enabled참조Scouter Weaver 플러그인 Hook 활성화이다.
hook_mongodb_enabledbooleantruehook_mongodb_enabled고급MongoDB 드라이버 Hook 활성화이다.

동작 원리: 바이트코드 위빙

[바이트코드 위빙 메커니즘]

JVM 기동 시:
1. -javaagent 옵션으로 에이전트 로드
2. ClassFileTransformer 등록
3. 설정 파일에서 hook_*_patterns 읽기
4. 패턴별 XOR 기반 시그니처 핑거프린트 생성

클래스 로딩 시:
function transform(class_name, bytecode):
// 패턴 매칭 (XOR 시그니처 기반 빠른 비교)
for each pattern in hook_patterns:
if match(class_name + method_name, pattern):
// 접근 제어자 필터
if method.access == PUBLIC AND NOT hook_method_access_public_enabled:
continue
if method.access == PRIVATE AND NOT hook_method_access_private_enabled:
continue
// ... protected, none 동일

// 제외 필터
if match(method_name, hook_method_ignore_prefixes):
continue
if match(class_name, hook_method_ignore_classes):
continue

// 바이트코드 수정: 진입/퇴출 지점에 추적 코드 삽입
bytecode = weave_entry(bytecode, method) // 시작 시간 기록
bytecode = weave_exit(bytecode, method) // 종료 시간 기록, 프로파일 스텝 추가

return bytecode

[시그니처 핑거프린트]
fingerprint = XOR(hash(pattern_1), hash(pattern_2), ...)
// 런타임에 패턴 변경 감지 → 변경 시 경고 로그 출력
// 실제 반영은 JVM 재시작 필요

주의사항: JVM 재시작 필요

[Hook 패턴 변경 시 동작]

ConfObserver가 hook_*_patterns 변경 감지
→ 시그니처 핑거프린트 비교
→ 불일치 시 경고 로그: "Hook pattern changed, JVM restart required"
→ 이미 로드된 클래스의 바이트코드는 변경되지 않음
→ JVM 재시작 전까지 이전 패턴으로 동작

[런타임 변경 가능 vs JVM 재시작 필요]

런타임 변경 가능:
- hook_method_access_*_enabled (접근 제어자 필터)
- hook_async_callrunnable_enabled
- hook_mongodb_enabled
- 대부분의 boolean on/off 토글

JVM 재시작 필요:
- hook_method_patterns (패턴 문자열 변경)
- hook_service_patterns
- hook_apicall_patterns
- hook_connection_open_patterns
- 모든 *_patterns 문자열 파라미터

11. Auto Dump

시스템 이상 상황을 자동 감지하여 ThreadDump/ActiveService 정보를 파일로 저장하는 파라미터이다. 2가지 트리거 모드를 지원한다.

파라미터 테이블

파라미터타입기본값conf 키중요도설명
autodump_enabledbooleanfalseautodump_enabled고급Active Service 기반 Auto Dump 활성화이다.
autodump_trigger_active_service_cntint10000autodump_trigger_active_service_cnt고급Auto Dump 트리거 Active Service 건수이다.
autodump_interval_msint30000autodump_interval_ms고급Auto Dump 실행 간격(ms). 최소 5000ms이다.
autodump_levelint1autodump_level고급Dump 수준. 1=ThreadDump, 2=ActiveService 목록, 3=ThreadList이다.
autodump_stuck_thread_msint0autodump_stuck_thread_ms참조Stuck 스레드 감지 기준(ms). 0이면 비활성화이다.
autodump_stuck_check_interval_msint10000autodump_stuck_check_interval_ms참조Stuck 스레드 감지 주기(ms)이다.
autodump_cpu_exceeded_enabledbooleanfalseautodump_cpu_exceeded_enabled고급CPU 과부하 기반 Auto Dump 활성화이다.
autodump_cpu_exceeded_threshold_pctint90autodump_cpu_exceeded_threshold_pct고급CPU 과부하 기준 백분율이다.
autodump_cpu_exceeded_duration_msint30000autodump_cpu_exceeded_duration_ms고급CPU 과부하 지속 시간(ms). 이 기간 동안 지속되어야 트리거된다.
autodump_cpu_exceeded_dump_interval_msint3000autodump_cpu_exceeded_dump_interval_ms참조CPU 과부하 시 Dump 수집 간격(ms)이다.
autodump_cpu_exceeded_dump_cntint3autodump_cpu_exceeded_dump_cnt참조CPU 과부하 시 Dump 수집 횟수이다.

동작 원리: 2가지 트리거 모드

[트리거 모드 1: Active Service 수 기반]

조건: autodump_enabled == true

모니터링 루프:
every autodump_interval_ms (최소 5000ms):
active_count = get_active_transaction_count()

if active_count > autodump_trigger_active_service_cnt:
// Dump 실행
switch autodump_level:
case 1:
dump = capture_thread_dump() // 전체 스레드 덤프
case 2:
dump = capture_active_services() // Active Service 목록만
case 3:
dump = capture_thread_list() // 스레드 이름 목록

write_to_file(dump_dir + "/autodump_" + timestamp)

// Stuck 스레드 감지 (옵션)
if autodump_stuck_thread_ms > 0:
for each thread in active_threads:
if thread.elapsed > autodump_stuck_thread_ms:
mark_as_stuck(thread)
capture_thread_stack(thread)


[트리거 모드 2: CPU 사용률 기반]

조건: autodump_cpu_exceeded_enabled == true

모니터링 루프:
cpu_exceeded_start = null

every 1 second:
cpu_usage = get_process_cpu_usage()

if cpu_usage > autodump_cpu_exceeded_threshold_pct: // > 90%
if cpu_exceeded_start == null:
cpu_exceeded_start = now()

if now() - cpu_exceeded_start > autodump_cpu_exceeded_duration_ms: // 30초 지속
// 연속 Dump 수집
for i in range(autodump_cpu_exceeded_dump_cnt): // 3회
dump = capture_thread_dump()
write_to_file(dump_dir + "/cpu_dump_" + timestamp + "_" + i)
wait(autodump_cpu_exceeded_dump_interval_ms) // 3초 간격

cpu_exceeded_start = null // 리셋 (다음 초과 시 재트리거)

else:
cpu_exceeded_start = null // CPU 정상 복귀 → 리셋

[Dump 파일 저장 위치]
dump_dir 파라미터 (기본: $AGENT_HOME/dump)

12. 알림/로그/카운터/요약 — P2/P3

에이전트 자체의 알림 전송, 로그 관리, 카운터 수집, 요약 통계 파라미터 중 P2/P3 항목이다. P1 항목은 10-1.agent-java-params.md를 참조한다.

Alert 파라미터 테이블

파라미터타입기본값conf 키중요도설명
alert_message_lengthint3000alert_message_length참조Alert 메시지 최대 길이(문자)이다.
alert_send_interval_msint10000alert_send_interval_ms고급Alert 전송 최소 간격(ms). 동일 Alert의 중복 전송을 방지한다.
alert_perm_warning_pctint90alert_perm_warning_pct고급PermGen/Metaspace 사용률 경고 기준(%). 이 값을 초과하면 Alert을 전송한다.

Log 파라미터 테이블

파라미터타입기본값conf 키중요도설명
log_enabledbooleanfalselog_enabled고급에이전트 로그 파일 기록 활성화이다.
log_dirString$AGENT_HOME/logslog_dir고급로그 파일 저장 디렉토리이다.
log_rotation_enabledbooleantruelog_rotation_enabled참조로그 파일 일별 로테이션 활성화이다.
log_keep_daysint7log_keep_days참조로그 파일 보관 일수. 이 기간 초과 로그는 자동 삭제된다.

Counter 파라미터 테이블

파라미터타입기본값conf 키중요도설명
counter_recentuser_valid_mslong300000counter_recentuser_valid_ms고급최근 사용자 유효 기간(ms). 기본 5분이다. 이 기간 내 활동 사용자를 "최근 사용자"로 집계한다.
counter_object_registry_pathString""counter_object_registry_path참조오브젝트 레지스트리 파일 경로. 에이전트 식별 정보를 파일로 저장한다.
counter_custom_jmx_enabledbooleanfalsecounter_custom_jmx_enabled참조JMX 커스텀 카운터 수집 활성화이다.
counter_interaction_enabledbooleanfalsecounter_interaction_enabled참조인터랙션 카운터 활성화. 서비스 간 호출 빈도를 측정한다.

Summary 파라미터 테이블

파라미터타입기본값conf 키중요도설명
summary_enabledbooleantruesummary_enabled고급요약 통계 수집 활성화. 서비스별 TPS, 평균 응답시간 등 5분 단위 요약 데이터를 생성한다.

SFA/PSTS Stack Dump 파라미터 테이블

파라미터타입기본값conf 키중요도설명
sfa_dump_enabledbooleanfalsesfa_dump_enabled참조SFA(Stack Frequency Analysis) Dump 활성화. Active Thread의 스택 빈도 분석 데이터를 수집한다.
sfa_dump_interval_msint10000sfa_dump_interval_ms참조SFA Dump 수집 간격(ms)이다.
enduser_trace_endpoint_urlString""enduser_trace_endpoint_url참조엔드유저 트레이스 엔드포인트 URL. 프론트엔드 성능 데이터를 수신할 URL을 지정한다.

관련 문서

문서설명
10-1.agent-java-params.mdJava Agent 파라미터 기본편 (P0/P1)
10.agent-java.mdJava Agent 설치 및 핵심 파라미터 가이드
14.collect-server.md수집 서버 설정
parameter-inventory.md전체 파라미터 인벤토리 (P0~P3 분류)