|
@@ -59,22 +59,22 @@ public class RemoteJsInvokeService extends AbstractJsInvokeService { |
|
@@ -59,22 +59,22 @@ public class RemoteJsInvokeService extends AbstractJsInvokeService { |
59
|
@Value("${js.remote.stats.enabled:false}")
|
59
|
@Value("${js.remote.stats.enabled:false}")
|
60
|
private boolean statsEnabled;
|
60
|
private boolean statsEnabled;
|
61
|
|
61
|
|
62
|
- private final AtomicInteger kafkaPushedMsgs = new AtomicInteger(0);
|
|
|
63
|
- private final AtomicInteger kafkaInvokeMsgs = new AtomicInteger(0);
|
|
|
64
|
- private final AtomicInteger kafkaEvalMsgs = new AtomicInteger(0);
|
|
|
65
|
- private final AtomicInteger kafkaFailedMsgs = new AtomicInteger(0);
|
|
|
66
|
- private final AtomicInteger kafkaTimeoutMsgs = new AtomicInteger(0);
|
62
|
+ private final AtomicInteger queuePushedMsgs = new AtomicInteger(0);
|
|
|
63
|
+ private final AtomicInteger queueInvokeMsgs = new AtomicInteger(0);
|
|
|
64
|
+ private final AtomicInteger queueEvalMsgs = new AtomicInteger(0);
|
|
|
65
|
+ private final AtomicInteger queueFailedMsgs = new AtomicInteger(0);
|
|
|
66
|
+ private final AtomicInteger queueTimeoutMsgs = new AtomicInteger(0);
|
67
|
|
67
|
|
68
|
@Scheduled(fixedDelayString = "${js.remote.stats.print_interval_ms}")
|
68
|
@Scheduled(fixedDelayString = "${js.remote.stats.print_interval_ms}")
|
69
|
public void printStats() {
|
69
|
public void printStats() {
|
70
|
if (statsEnabled) {
|
70
|
if (statsEnabled) {
|
71
|
- int pushedMsgs = kafkaPushedMsgs.getAndSet(0);
|
|
|
72
|
- int invokeMsgs = kafkaInvokeMsgs.getAndSet(0);
|
|
|
73
|
- int evalMsgs = kafkaEvalMsgs.getAndSet(0);
|
|
|
74
|
- int failed = kafkaFailedMsgs.getAndSet(0);
|
|
|
75
|
- int timedOut = kafkaTimeoutMsgs.getAndSet(0);
|
71
|
+ int pushedMsgs = queuePushedMsgs.getAndSet(0);
|
|
|
72
|
+ int invokeMsgs = queueInvokeMsgs.getAndSet(0);
|
|
|
73
|
+ int evalMsgs = queueEvalMsgs.getAndSet(0);
|
|
|
74
|
+ int failed = queueFailedMsgs.getAndSet(0);
|
|
|
75
|
+ int timedOut = queueTimeoutMsgs.getAndSet(0);
|
76
|
if (pushedMsgs > 0 || invokeMsgs > 0 || evalMsgs > 0 || failed > 0 || timedOut > 0) {
|
76
|
if (pushedMsgs > 0 || invokeMsgs > 0 || evalMsgs > 0 || failed > 0 || timedOut > 0) {
|
77
|
- log.info("Kafka JS Invoke Stats: pushed [{}] received [{}] invoke [{}] eval [{}] failed [{}] timedOut [{}]",
|
77
|
+ log.info("Queue JS Invoke Stats: pushed [{}] received [{}] invoke [{}] eval [{}] failed [{}] timedOut [{}]",
|
78
|
pushedMsgs, invokeMsgs + evalMsgs, invokeMsgs, evalMsgs, failed, timedOut);
|
78
|
pushedMsgs, invokeMsgs + evalMsgs, invokeMsgs, evalMsgs, failed, timedOut);
|
79
|
}
|
79
|
}
|
80
|
}
|
80
|
}
|
|
@@ -116,19 +116,19 @@ public class RemoteJsInvokeService extends AbstractJsInvokeService { |
|
@@ -116,19 +116,19 @@ public class RemoteJsInvokeService extends AbstractJsInvokeService { |
116
|
if (maxRequestsTimeout > 0) {
|
116
|
if (maxRequestsTimeout > 0) {
|
117
|
future = Futures.withTimeout(future, maxRequestsTimeout, TimeUnit.MILLISECONDS, timeoutExecutorService);
|
117
|
future = Futures.withTimeout(future, maxRequestsTimeout, TimeUnit.MILLISECONDS, timeoutExecutorService);
|
118
|
}
|
118
|
}
|
119
|
- kafkaPushedMsgs.incrementAndGet();
|
119
|
+ queuePushedMsgs.incrementAndGet();
|
120
|
Futures.addCallback(future, new FutureCallback<TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse>>() {
|
120
|
Futures.addCallback(future, new FutureCallback<TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse>>() {
|
121
|
@Override
|
121
|
@Override
|
122
|
public void onSuccess(@Nullable TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse> result) {
|
122
|
public void onSuccess(@Nullable TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse> result) {
|
123
|
- kafkaEvalMsgs.incrementAndGet();
|
123
|
+ queueEvalMsgs.incrementAndGet();
|
124
|
}
|
124
|
}
|
125
|
|
125
|
|
126
|
@Override
|
126
|
@Override
|
127
|
public void onFailure(Throwable t) {
|
127
|
public void onFailure(Throwable t) {
|
128
|
if (t instanceof TimeoutException || (t.getCause() != null && t.getCause() instanceof TimeoutException)) {
|
128
|
if (t instanceof TimeoutException || (t.getCause() != null && t.getCause() instanceof TimeoutException)) {
|
129
|
- kafkaTimeoutMsgs.incrementAndGet();
|
129
|
+ queueTimeoutMsgs.incrementAndGet();
|
130
|
}
|
130
|
}
|
131
|
- kafkaFailedMsgs.incrementAndGet();
|
131
|
+ queueFailedMsgs.incrementAndGet();
|
132
|
}
|
132
|
}
|
133
|
}, MoreExecutors.directExecutor());
|
133
|
}, MoreExecutors.directExecutor());
|
134
|
return Futures.transform(future, response -> {
|
134
|
return Futures.transform(future, response -> {
|
|
@@ -170,20 +170,20 @@ public class RemoteJsInvokeService extends AbstractJsInvokeService { |
|
@@ -170,20 +170,20 @@ public class RemoteJsInvokeService extends AbstractJsInvokeService { |
170
|
if (maxRequestsTimeout > 0) {
|
170
|
if (maxRequestsTimeout > 0) {
|
171
|
future = Futures.withTimeout(future, maxRequestsTimeout, TimeUnit.MILLISECONDS, timeoutExecutorService);
|
171
|
future = Futures.withTimeout(future, maxRequestsTimeout, TimeUnit.MILLISECONDS, timeoutExecutorService);
|
172
|
}
|
172
|
}
|
173
|
- kafkaPushedMsgs.incrementAndGet();
|
173
|
+ queuePushedMsgs.incrementAndGet();
|
174
|
Futures.addCallback(future, new FutureCallback<TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse>>() {
|
174
|
Futures.addCallback(future, new FutureCallback<TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse>>() {
|
175
|
@Override
|
175
|
@Override
|
176
|
public void onSuccess(@Nullable TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse> result) {
|
176
|
public void onSuccess(@Nullable TbProtoQueueMsg<JsInvokeProtos.RemoteJsResponse> result) {
|
177
|
- kafkaInvokeMsgs.incrementAndGet();
|
177
|
+ queueInvokeMsgs.incrementAndGet();
|
178
|
}
|
178
|
}
|
179
|
|
179
|
|
180
|
@Override
|
180
|
@Override
|
181
|
public void onFailure(Throwable t) {
|
181
|
public void onFailure(Throwable t) {
|
182
|
onScriptExecutionError(scriptId);
|
182
|
onScriptExecutionError(scriptId);
|
183
|
if (t instanceof TimeoutException || (t.getCause() != null && t.getCause() instanceof TimeoutException)) {
|
183
|
if (t instanceof TimeoutException || (t.getCause() != null && t.getCause() instanceof TimeoutException)) {
|
184
|
- kafkaTimeoutMsgs.incrementAndGet();
|
184
|
+ queueTimeoutMsgs.incrementAndGet();
|
185
|
}
|
185
|
}
|
186
|
- kafkaFailedMsgs.incrementAndGet();
|
186
|
+ queueFailedMsgs.incrementAndGet();
|
187
|
}
|
187
|
}
|
188
|
}, MoreExecutors.directExecutor());
|
188
|
}, MoreExecutors.directExecutor());
|
189
|
return Futures.transform(future, response -> {
|
189
|
return Futures.transform(future, response -> {
|