Vladsz83 commented on a change in pull request #9457:
URL: https://github.com/apache/ignite/pull/9457#discussion_r772927368
##########
File path:
modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
##########
@@ -455,12 +463,39 @@ T proxy() {
/**
* @param mtd Method to invoke.
*/
- String methodName(Method mtd) {
+ static String methodName(Method mtd) {
PlatformServiceMethod ann =
mtd.getDeclaredAnnotation(PlatformServiceMethod.class);
return ann == null ? mtd.getName() : ann.value();
}
+ /**
+ * Calls the target, measures and registers its duration.
+ *
+ * @param srvCtx Service context.
+ * @param mtdName Related method name.
+ * @param target Target to call and measure.
+ */
+ private static <T> T measureCall(
+ ServiceContextImpl srvCtx,
+ String mtdName,
+ Callable<T> target
+ ) throws Exception {
+ long startTime = System.nanoTime();
+
+ try {
+ return target.call();
+ }
+ finally {
+ long duration = System.nanoTime() - startTime;
+
+ HistogramMetricImpl histogram = srvCtx.metrics() == null ? null :
srvCtx.metrics().findMetric(mtdName);
+
+ if (histogram != null)
Review comment:
Very NPE-dangerous. We do not cover .NET services yet (ticket
IGNITE-15650). We should skip measuring of methods like metricIgnored(), We
ignore Serialized-method or Externalizable. Or any of our service method like
PlatformService.*. User shouldn't implement services as Externalizable of
course. But it is technically possible I think.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]