프로젝트 JVM 메트릭을 계측 수집 중지 : 내가 웹 스피어 애플리케이션 서버의 JVM 메트릭을 모니터링 sFlow를 + 신경절을 사용JMX-SflowAgent는 WebSphere Application Server에에게 AspectJ의에서
을 (WAS). WAS는 AspectJ 측면을 사용하여 구현된다. 모든 응용 프로그램 메서드 런타임을 측정하는 측면을 추가했습니다.
Hsflowd를 JVM 메트릭 수집기로 사용합니다. Hsflowd는 내부적으로 JMX-SflowAgent javaagent를 사용하여 JVM에 연결하여 MXBeans (RuntimeMXBean, GarbageCollectorMXBean, CompilationMXBean 및 ThreadMXBean)를 사용하여 메트릭을 수집합니다.
문제 : 내가 계속 신경절 웹에있는 모든 메트릭 (CPU, 책상, 메모리, 프로세스 등)을 볼 수 있습니다 aspectjweaver 후크없이 WAS 실행
. 하지만 aspectjweaver가 JVM 인수에 추가되고 서버를 다시 시작한 후 10 분 동안 메트릭을 볼 수는 있지만 이후 Ganglia 웹의 JVM 메트릭은보고하지 않습니다.
Aspectj weaving 로그에서 AspectJ가 JMXsflowAgent 코드를 구성하고 있음을 알 수 있습니다. 비록 그것이 !call(* com.sflow.JMX.SFlowAgent(..))
을 통해 제외 되더라도.
측면 :
package com.foo.main;
import java.io.*;
import java.lang.reflect.Method;
import java.security.Signature;
import java.util.*;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.osgi.service.application.ApplicationAdminPermission;
@Aspect
public class ResponseTimeAspect {
@Pointcut(
"execution(* com.foo.*(..)) && " +
"!within(com.foo.main.ResponseTimeAspect) && " +
"!within(ThreadLocal+) && " +
"!within(&& !within(*..*Aspect)) && " +
"!within(com.foo.main.AppInformationReader) && " +
"!within(@org.aspectj.lang.annotation.Aspect *) && " +
"!within(com.sflow.jmx.SFlowAgent) && " +
"!(call(* com.sflow.jmx.SFlowAgent(..)))"
)
public void loggingResponseTime() {}
private static ThreadLocal<String> uuidContainer = new ThreadLocal<String>() {
@Override
protected String initialValue(){
return UUID.randomUUID().toString();
}
};
AppInformationReader logWriter = AppInformationReader.getInstance();
@Around("loggingResponseTime()")
public Object tracing(ProceedingJoinPoint thisJoinPoint) throws Throwable {
Long startTime= System.currentTimeMillis();
Long startTotalMemory = Runtime.getRuntime().totalMemory();
Long startFreeMemory = Runtime.getRuntime().freeMemory();
Object ret = thisJoinPoint.proceed();
Long elapsedTime=System.currentTimeMillis() - startTime;
Long endTotalMemory = Runtime.getRuntime().totalMemory();
Long endFreeMemory = Runtime.getRuntime().freeMemory();
String methodSignature=thisJoinPoint.getSignature().toString();
String classname=methodSignature.split("\\.")[thisJoinPoint.getSignature().toString().split("\\.").length-1];
String methodName =thisJoinPoint.getSignature().getDeclaringType().getCanonicalName();
logWriter.writeLog(uuidContainer.get().toString(), startTime, System.currentTimeMillis(), elapsedTime, classname, methodName);
return ret;
}
}
되고있는 JMX 패키지 com.sflow.jmx.SFlowAgent
받고있다.
우리가 볼 수없는 AspectJ 또는 Java 코드와 우리가 볼 수없는 구성에 대해 지적인 말을하기가 약간 어렵다. 어쩌면 여기에 아무도 마법의 크리스탈 지구본을 가지고 있지 않으므로 더 자세한 정보를 제공하는 것을 고려하고 싶을 것입니다. – kriegaex
@ Kriegaex- 추가 구성이 필요하지 않습니다. JMX와 AspectJ가 우리 데스크탑에서 함께 작동하지 않을 것이라고 생각합니다. –
왜 안되나요? – kriegaex