This is an automated email from the ASF dual-hosted git repository.
mxsm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new a003c03e5 [ISSUE #4551] modify the logic of time-consumption
statistics (#4822)
a003c03e5 is described below
commit a003c03e5f18cb7878087b79f150dbd339da4956
Author: Zaki <[email protected]>
AuthorDate: Thu Apr 11 11:38:22 2024 +0800
[ISSUE #4551] modify the logic of time-consumption statistics (#4822)
---
.../core/protocol/http/processor/HandlerService.java | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/HandlerService.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/HandlerService.java
index 0c6437f8b..b68ea2f64 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/HandlerService.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/HandlerService.java
@@ -278,7 +278,6 @@ public class HandlerService {
}
ProcessorWrapper processorWrapper =
HandlerService.this.httpProcessorMap.get(processorKey);
try {
- this.preHandler();
if (processorWrapper.httpProcessor instanceof
AsyncHttpProcessor) {
// set actual async request
HttpEventWrapper httpEventWrapper =
parseHttpRequest(request);
@@ -289,10 +288,10 @@ public class HandlerService {
response = processorWrapper.httpProcessor.handler(request);
if (processorWrapper.httpProcessor instanceof
ShortHttpProcessor) {
- this.postHandler(ConnectionType.SHORT_LIVED);
+
this.postHandlerWithTimeCostRecord(ConnectionType.SHORT_LIVED);
return;
}
- this.postHandler(ConnectionType.PERSISTENT);
+ this.postHandlerWithTimeCostRecord(ConnectionType.PERSISTENT);
} catch (Throwable e) {
exception = e;
// todo: according exception to generate response
@@ -301,6 +300,12 @@ public class HandlerService {
}
}
+ private void postHandlerWithTimeCostRecord(ConnectionType type) {
+
metrics.getSummaryMetrics().recordHTTPReqResTimeCost(System.currentTimeMillis()
- requestTime);
+ HTTP_LOGGER.debug("{}", response);
+ postHandler(type);
+ }
+
private void postHandler(ConnectionType type) {
metrics.getSummaryMetrics().recordHTTPRequest();
HTTP_LOGGER.debug("{}", request);
@@ -315,10 +320,6 @@ public class HandlerService {
}
}
- private void preHandler() {
-
metrics.getSummaryMetrics().recordHTTPReqResTimeCost(System.currentTimeMillis()
- requestTime);
- HTTP_LOGGER.debug("{}", response);
- }
private void error() {
log.error(this.exception.getMessage(), this.exception);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]