|
|
|
@ -105,7 +105,7 @@ public class MonitorAdvice implements DesignerAnalyzerAdvice {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String getErrorContent(Exception e) { |
|
|
|
|
public static String getErrorContent(Exception e) { |
|
|
|
|
int errorCode = GeneralUtils.objectToNumber( |
|
|
|
|
extractCodeFromString(e.getMessage()) |
|
|
|
|
).intValue(); |
|
|
|
@ -113,7 +113,7 @@ public class MonitorAdvice implements DesignerAnalyzerAdvice {
|
|
|
|
|
return e.getClass().getName() + ":" + (errorCode >= MIN_ERROR_CODE ? errorCode : StringUtils.EMPTY); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String extractCodeFromString(String errorMsg) { |
|
|
|
|
public static String extractCodeFromString(String errorMsg) { |
|
|
|
|
Matcher m = P.matcher(errorMsg); |
|
|
|
|
if (m.find()) { |
|
|
|
|
return m.group(); |
|
|
|
@ -121,25 +121,25 @@ public class MonitorAdvice implements DesignerAnalyzerAdvice {
|
|
|
|
|
return StringUtils.EMPTY; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void recordSQLDetail(String uuid) { |
|
|
|
|
public static void recordSQLDetail(String uuid) { |
|
|
|
|
DBMeterFactory.getMeter().submit(uuid); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void recordSQL(Compute once, MeasureObject measureObject) { |
|
|
|
|
public static void recordSQL(Compute once, MeasureObject measureObject) { |
|
|
|
|
if (SupervisoryConfig.getInstance().isEnableMeasureSql() && once.computeSql()) { |
|
|
|
|
measureObject.sqlTime(SessionLocalManager.getSqlTime()); |
|
|
|
|
measureObject.sql(SessionLocalManager.getSql()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void recordMemory(Compute once, Measurable measurable, MeasureObject measureObject) { |
|
|
|
|
public static void recordMemory(Compute once, Measurable measurable, MeasureObject measureObject) { |
|
|
|
|
if (SupervisoryConfig.getInstance().isEnableMeasureMemory() && once.computeMemory()) { |
|
|
|
|
MeasureUnit unit = measurable.measureUnit(); |
|
|
|
|
measureObject.memory(unit.measureMemory()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static boolean findSessionAnnotation(Method method, Object[] args) { |
|
|
|
|
public static boolean findSessionAnnotation(Method method, Object[] args) { |
|
|
|
|
Annotation[][] all = method.getParameterAnnotations(); |
|
|
|
|
int len = ArrayUtils.getLength(args); |
|
|
|
|
for (int i = 0; i < len; i++) { |
|
|
|
|