- Default File Location :
${directory of scouter.agent.jar}/plugin - 또는 설정 가능 ->
plugin_dir=/aaa/bbb/ccc/plugin - plugin 파일에 java 코드 기록시 런타임에 동적으로 코드를 컴파일하여 로딩, 바로 적용됨
- Plugin 종류
- Http-service
- Service
- HttpCall
- Capture
- JDBC-Pool
void start(WrContext $ctx, WrRequest $req, WrResponse $res): Http Service 시작 시점void end(WrContext $ctx, WrRequest $req, WrResponse $res): Http Service 종료 시점boolean reject(WrContext $ctx, WrRequest $req, WrResponse $res): Http Service 시작 시점에 reject 조건 (default : false)
hook_service_patterns 에 정의된 method 에서 호출됨
void start(WrContext $ctx, HookArgs $hook): Service 시작 시점void end(WrContext $ctx): Service 종료 시점
void call(WrContext $ctx, WrHttpCallRequest $req): Http Call 요청 시점
hook_args_patterns, hook_return_patterns, hook_constructor_patterns 에 정의된 method 에서 호출됨
void capArgs(WrContext $ctx, HookArgs $hook): Method 시작 시점void capReturn(WrContext $ctx, HookReturn $hook): Method Return 시점void capThis(WrContext $ctx, String $class, String $desc, Object $this): Constructor 생성 시점
String url(WrContext $ctx, String $msg, Object $pool): DB Connection URL 요청 시점
void log(Object c): Logger를 통한 logvoid println(Object c): System.out를 통한 logObject getFieldValue(Object o, String fieldName): get field value as object of 'o'Object invokeMethod(Object o, String methodName): invoke the methodObject invokeMethod(Object o, String methodName, Object[] args): invoke the method with argsObject invokeMethod(Object o, String methodName, Class[] argTypes, Object[] args): invoke the method with argsObject newInstance(String className): new instance of the classObject newInstance(String className, ClassLoader loader): new instance of the class from the classloaderObject newInstance(String className, Object[] args): new instance of the class with argumentsObject newInstance(String className, ClassLoader loader, Object[] args): new instance of the class with arguments from the classloaderObject newInstance(String className, ClassLoader loader, Class[] argTypes, Object[] args): new instance of the class with arguments from the classloaderString toString(Object o): Object 를 toString 하여 반환String toString(Object o, String def): Object 를 toString 하여 반환, null 이면 default string 반환void alert(char level, String title, String message): Alert 을 보냄 (level : i|w|e|f as info, warn, error, fatal).Class[] makeArgTypes(Class class0, Class class1, ..., classN): assemble argument types array to call the reflection methodinvokeMethod()Object[] makeArgs(Object obj0, Object obj1, ..., objN): assemble arguments array to call the reflection methodinvokeMethod()
String service(): Service Name 을 반환void service(String name): Service Name 을 setint serviceHash(): Service Hash 값을 반환void remoteIp(String ip): Remote IP 을 setString remoteIp(): Remote IP를 반환void error(String err): 임의의 error 를 주입boolean isError(): 에러 체크void group(String group): 임의의 group을 setString group(): Group을 반환void login(String id): 임의의 사용자 ID 를 setString login(): 사용자 ID를 반환void desc(String desc): 임의의 Desc를 setString desc(): Desc를 반환String httpMethod(): Http Method를 반환String httpQuery(): Http Query를 반환String httpContentType(): Http Content-type을 반환String userAgent(): User-Agent를 반환void profile(String msg): Msg 를 profile에 기록void hashProfile(String msg, int value, int elapsed): profile a message as hash value to the XLog profileparameterizedProfile(int level, String msgFormat, int elapsed, String[] params): profile a message format with parameters.- message example : "Hello, my name is %s and my age is %s"
- level : 0-debug, 1-info, 2-warn, 3-error, 4-fatal
long txid(): txid 를 반환long gxid(): gxid 를 반환TraceContext inner(): context를 반환
String getCookie(String key): Cookie 값을 반환String getRequestURI(): Request URI를 반환String getRemoteAddr(): Remote Address를 반환String getMethod(): Method 를 반환String getQueryString(): Query String을 반환String getParameter(String key): Parameter를 반환Object getAttribute(String key): Attribute를 반환String getHeader(String key): Header값을 반환Enumeration getParameterNames(): Parameter 값들을 반환Enumeration getHeaderNames(): HeaderName들을 반환WrSession getSession(): WrSession객체를 반환Set getSessionNames(): Session Name들을 반환Object getSessionAttribute(String key): Session 값을 반환Object inner(): Request Object를 반환boolean isOk(): Plugin 상태 확인Throwable error(): Error 확인
PrintWriter getWriter(): Writer를 반환String getContentType(): Content-type을 반환String getCharacterEncoding(): Character-encoding을 반환Object inner(): Response Object를 반환boolean isOk(): Plugin 상태 확인Throwable error(): Error 확인
getAttribute(String key): Attribute를 반환Enumeration getAttributeNames(): Attribute Names를 반환Object inner(): Session Object를 반환boolean isOk(): Plugin 상태 확인Throwable error(): Error 확인
void header(Object key, Object value): Header값 추가Object inner(): Request Object를 반환boolean isOk(): Plugin 상태 확인Throwable error(): Error 확인
String getClassName(): Class 이름 반환String getMethodName(): Method 이름 반환String getMethodDesc(): Method 의 Desc 반환Object getThis(): this object 반환Object[] getArgs(): Arguments 반환int getArgCount(): Argument 갯수 반환
String getClassName(): Class 이름 반환String getMethodName(): Method 이름 반환String getMethodDesc(): Method 의 Desc 반환Object getThis(): this object 반환Object getReturn(): Return 값 반환