You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2023/02/09 14:11:52 UTC
[shardingsphere] branch master updated: Optimize execute latency millis metric (#24083)
This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new c107842f7d9 Optimize execute latency millis metric (#24083)
c107842f7d9 is described below
commit c107842f7d9be1a4a11b4046ea22d2ac3f03e49a
Author: jiangML <10...@qq.com>
AuthorDate: Thu Feb 9 22:11:44 2023 +0800
Optimize execute latency millis metric (#24083)
* Split the executeCommand method in CommandExecutorTask
* update pointcut method for metric
---
.../src/main/resources/META-INF/conf/prometheus-proxy-advisors.yaml | 2 +-
.../shardingsphere/proxy/frontend/command/CommandExecutorTask.java | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/agent/plugins/metrics/type/prometheus/src/main/resources/META-INF/conf/prometheus-proxy-advisors.yaml b/agent/plugins/metrics/type/prometheus/src/main/resources/META-INF/conf/prometheus-proxy-advisors.yaml
index 71ef799ecd0..3dc44bb73c5 100644
--- a/agent/plugins/metrics/type/prometheus/src/main/resources/META-INF/conf/prometheus-proxy-advisors.yaml
+++ b/agent/plugins/metrics/type/prometheus/src/main/resources/META-INF/conf/prometheus-proxy-advisors.yaml
@@ -19,7 +19,7 @@ advisors:
- target: org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask
advice: org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy.ExecuteLatencyHistogramAdvice
pointcuts:
- - name: run
+ - name: doExecuteCommand
type: method
- target: org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask
advice: org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy.ExecuteErrorsCountAdvice
diff --git a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/command/CommandExecutorTask.java b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/command/CommandExecutorTask.java
index fc01b8bd9b2..33b7c927f21 100644
--- a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/command/CommandExecutorTask.java
+++ b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/command/CommandExecutorTask.java
@@ -106,6 +106,10 @@ public final class CommandExecutorTask implements Runnable {
CommandPacketType type = commandExecuteEngine.getCommandPacketType(payload);
CommandPacket commandPacket = commandExecuteEngine.getCommandPacket(payload, type, connectionSession);
CommandExecutor commandExecutor = commandExecuteEngine.getCommandExecutor(type, commandPacket, connectionSession);
+ return doExecuteCommand(context, commandExecuteEngine, commandExecutor);
+ }
+
+ private boolean doExecuteCommand(final ChannelHandlerContext context, final CommandExecuteEngine commandExecuteEngine, final CommandExecutor commandExecutor) throws SQLException {
try {
Collection<DatabasePacket<?>> responsePackets = commandExecutor.execute();
if (responsePackets.isEmpty()) {