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