|
|
|
@ -9,6 +9,7 @@ import com.fr.intelli.record.Measurable;
|
|
|
|
|
import com.fr.intelli.record.MeasureObject; |
|
|
|
|
import com.fr.intelli.record.MeasureUnit; |
|
|
|
|
import com.fr.intelli.record.MetricRegistry; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.measure.DBMeterFactory; |
|
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
@ -79,25 +80,17 @@ public class MonitorAdvice implements DesignerAnalyzerAdvice {
|
|
|
|
|
List<Object> newArgs = new ArrayList<>(Arrays.asList(args)); |
|
|
|
|
newArgs.add(id); |
|
|
|
|
recordSQLDetail(id); |
|
|
|
|
String sessionID = null; |
|
|
|
|
SessionProvider provider = SessionLocalManager.getSession(); |
|
|
|
|
if (provider != null) { |
|
|
|
|
sessionID = provider.getSessionID(); |
|
|
|
|
} |
|
|
|
|
if (measurable instanceof Estimator) { |
|
|
|
|
measurable.asyncDurable(measureObject, newArgs.toArray()); |
|
|
|
|
} else { |
|
|
|
|
Object message; |
|
|
|
|
Object message = null; |
|
|
|
|
try { |
|
|
|
|
message = measurable.durableEntity(measureObject, newArgs.toArray()); |
|
|
|
|
} catch (Throwable throwable) { |
|
|
|
|
//埋点生成失败,降级逻辑
|
|
|
|
|
message = measurable.fallBackEntity(); |
|
|
|
|
FineLoggerFactory.getLogger().error(throwable.getMessage(), throwable); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isEmpty(sessionID)) { |
|
|
|
|
if (message != null) { |
|
|
|
|
MetricRegistry.getMetric().submit(message); |
|
|
|
|
} else { |
|
|
|
|
MetricRegistry.getMetric().submitAccumulativeData(sessionID, message); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|