This is an automated email from the ASF dual-hosted git repository.
luoxiaolong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 721a92c [type: feature]: add shenyu_dubbo_request_total metrics.
(#2944)
721a92c is described below
commit 721a92c3d595e2f3c2df65c573f8c4c2f5dbf387
Author: YuI <[email protected]>
AuthorDate: Thu Mar 3 10:40:38 2022 +0800
[type: feature]: add shenyu_dubbo_request_total metrics. (#2944)
Co-authored-by: 艺铭 <[email protected]>
---
pom.xml | 2 +-
.../metrics/api/constant/MetricsConstant.java | 38 ++++++++++++++--
.../handler/PrometheusDubboPluginHandler.java | 43 ++++++++++++++++++
.../handler/PrometheusGlobalPluginHandler.java | 12 ++---
.../handler/PrometheusGrpcPluginHandler.java | 43 ++++++++++++++++++
.../handler/PrometheusMotanPluginHandler.java | 43 ++++++++++++++++++
.../handler/PrometheusSofaPluginHandler.java | 43 ++++++++++++++++++
.../PrometheusSpringCloudPluginHandler.java | 43 ++++++++++++++++++
.../handler/PrometheusTarsPluginHandler.java | 43 ++++++++++++++++++
.../src/main/resources/conf/metrics-meta.yaml | 43 +++++++++++++++++-
.../src/main/resources/conf/metrics-point.yaml | 51 +++++++++++++++++++++-
11 files changed, 390 insertions(+), 14 deletions(-)
diff --git a/pom.xml b/pom.xml
index 024bf86..2c3a7bf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,7 +86,7 @@
<mysql.version>5.1.47</mysql.version>
<druid.version>1.0.29</druid.version>
<commons-lang3.version>3.3.2</commons-lang3.version>
- <guava.version>[30.1-jre,)</guava.version>
+ <guava.version>30.1-jre</guava.version>
<commons-collections4.version>4.1</commons-collections4.version>
<reactor-spring.version>1.0.1.RELEASE</reactor-spring.version>
<disruptor.version>3.4.0</disruptor.version>
diff --git
a/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-api/src/main/java/org/apache/shenyu/agent/plugin/metrics/api/constant/MetricsConstant.java
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-api/src/main/java/org/apache/shenyu/agent/plugin/metrics/api/constant/MetricsConstant.java
index 0ddc1e7..35573fe 100644
---
a/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-api/src/main/java/org/apache/shenyu/agent/plugin/metrics/api/constant/MetricsConstant.java
+++
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-api/src/main/java/org/apache/shenyu/agent/plugin/metrics/api/constant/MetricsConstant.java
@@ -43,13 +43,43 @@ public final class MetricsConstant {
public static final String HTTP_REQUEST_TOTAL =
"shenyu_http_request_total";
/**
- * The constant SHENYU_REQUEST_UNDONE.
+ * The constant DUBBO_REQUEST_TOTAL.
*/
- public static final String SHENYU_REQUEST_UNDONE = "shenyu_request_undone";
+ public static final String DUBBO_REQUEST_TOTAL =
"shenyu_dubbo_request_total";
/**
- * The constant SHENYU_EXECUTE_LATENCY_MILLIS.
+ * The constant GRPC_REQUEST_TOTAL.
*/
- public static final String SHENYU_EXECUTE_LATENCY_MILLIS =
"shenyu_execute_latency_millis";
+ public static final String GRPC_REQUEST_TOTAL =
"shenyu_grpc_request_total";
+
+ /**
+ * The constant MOTAN_REQUEST_TOTAL.
+ */
+ public static final String MOTAN_REQUEST_TOTAL =
"shenyu_motan_request_total";
+
+ /**
+ * The constant SOFA_REQUEST_TOTAL.
+ */
+ public static final String SOFA_REQUEST_TOTAL =
"shenyu_sofa_request_total";
+
+ /**
+ * The constant TARS_REQUEST_TOTAL.
+ */
+ public static final String TARS_REQUEST_TOTAL =
"shenyu_tars_request_total";
+
+ /**
+ * The constant SPRING_CLOUD_REQUEST_TOTAL.
+ */
+ public static final String SPRING_CLOUD_REQUEST_TOTAL =
"shenyu_spring_cloud_request_total";
+
+ /**
+ * The constant REQUEST_UNDONE.
+ */
+ public static final String REQUEST_UNDONE = "shenyu_request_undone";
+
+ /**
+ * The constant EXECUTE_LATENCY_MILLIS.
+ */
+ public static final String EXECUTE_LATENCY_MILLIS =
"shenyu_execute_latency_millis";
}
diff --git
a/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusDubboPluginHandler.java
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusDubboPluginHandler.java
new file mode 100644
index 0000000..37e54e9
--- /dev/null
+++
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusDubboPluginHandler.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.agent.plugin.metrics.prometheus.handler;
+
+import org.apache.shenyu.agent.api.entity.MethodResult;
+import org.apache.shenyu.agent.api.entity.TargetObject;
+import org.apache.shenyu.agent.api.handler.InstanceMethodHandler;
+import org.apache.shenyu.agent.plugin.metrics.api.constant.MetricsConstant;
+import
org.apache.shenyu.agent.plugin.metrics.common.factory.MetricsRecorderPool;
+import org.springframework.web.server.ServerWebExchange;
+
+import java.lang.reflect.Method;
+
+/**
+ * The type metrics prometheus dubbo plugin, about apache dubbo or alibaba
dubbo, handler.
+ */
+public class PrometheusDubboPluginHandler implements InstanceMethodHandler {
+
+ @Override
+ public void before(final TargetObject target, final Method method, final
Object[] args, final MethodResult result) {
+ final ServerWebExchange exchange = (ServerWebExchange) args[0];
+ final String path = exchange.getRequest().getURI().getPath();
+
+ MetricsRecorderPool.get(MetricsConstant.DUBBO_REQUEST_TOTAL,
MetricsConstant.PROMETHEUS)
+ .ifPresent(metricsRecorder -> metricsRecorder.inc(path));
+ }
+
+}
diff --git
a/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusGlobalPluginHandler.java
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusGlobalPluginHandler.java
index ee98d7f..e69c15d 100644
---
a/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusGlobalPluginHandler.java
+++
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusGlobalPluginHandler.java
@@ -38,23 +38,23 @@ public final class PrometheusGlobalPluginHandler implements
InstanceMethodHandle
@Override
public void before(final TargetObject target, final Method method, final
Object[] args, final MethodResult result) {
MetricsRecorderPool.get(MetricsConstant.REQUEST_TOTAL,
MetricsConstant.PROMETHEUS).ifPresent(MetricsRecorder::inc);
- MetricsRecorderPool.get(MetricsConstant.SHENYU_REQUEST_UNDONE,
MetricsConstant.PROMETHEUS).ifPresent(MetricsRecorder::inc);
+ MetricsRecorderPool.get(MetricsConstant.REQUEST_UNDONE,
MetricsConstant.PROMETHEUS).ifPresent(MetricsRecorder::inc);
final ServerWebExchange exchange = (ServerWebExchange) args[0];
-
exchange.getAttributes().put(MetricsConstant.SHENYU_EXECUTE_LATENCY_MILLIS,
LocalDateTime.now());
+ exchange.getAttributes().put(MetricsConstant.EXECUTE_LATENCY_MILLIS,
LocalDateTime.now());
}
@Override
public Object after(final TargetObject target, final Method method, final
Object[] args, final MethodResult methodResult) {
- MetricsRecorderPool.get(MetricsConstant.SHENYU_REQUEST_UNDONE,
MetricsConstant.PROMETHEUS).ifPresent(MetricsRecorder::dec);
+ MetricsRecorderPool.get(MetricsConstant.REQUEST_UNDONE,
MetricsConstant.PROMETHEUS).ifPresent(MetricsRecorder::dec);
final ServerWebExchange exchange = (ServerWebExchange) args[0];
final String path = exchange.getRequest().getURI().getPath();
- LocalDateTime startTime = (LocalDateTime)
exchange.getAttributes().get(MetricsConstant.SHENYU_EXECUTE_LATENCY_MILLIS);
+ LocalDateTime startTime = (LocalDateTime)
exchange.getAttributes().get(MetricsConstant.EXECUTE_LATENCY_MILLIS);
Object result = methodResult.getResult();
if (result instanceof Mono) {
return ((Mono) result).doFinally(s -> {
-
MetricsRecorderPool.get(MetricsConstant.SHENYU_EXECUTE_LATENCY_MILLIS,
MetricsConstant.PROMETHEUS)
+
MetricsRecorderPool.get(MetricsConstant.EXECUTE_LATENCY_MILLIS,
MetricsConstant.PROMETHEUS)
.ifPresent(metricsRecorder ->
metricsRecorder.observe(DateUtils.acquireMillisBetween(startTime,
LocalDateTime.now()), path));
});
}
@@ -65,7 +65,7 @@ public final class PrometheusGlobalPluginHandler implements
InstanceMethodHandle
@Override
public void onThrowing(final TargetObject target, final Method method,
final Object[] args, final Throwable throwable) {
MetricsRecorderPool.get(MetricsConstant.REQUEST_THROW_TOTAL,
MetricsConstant.PROMETHEUS).ifPresent(MetricsRecorder::inc);
- MetricsRecorderPool.get(MetricsConstant.SHENYU_REQUEST_UNDONE,
MetricsConstant.PROMETHEUS).ifPresent(MetricsRecorder::dec);
+ MetricsRecorderPool.get(MetricsConstant.REQUEST_UNDONE,
MetricsConstant.PROMETHEUS).ifPresent(MetricsRecorder::dec);
}
}
diff --git
a/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusGrpcPluginHandler.java
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusGrpcPluginHandler.java
new file mode 100644
index 0000000..e65cce5
--- /dev/null
+++
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusGrpcPluginHandler.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.agent.plugin.metrics.prometheus.handler;
+
+import org.apache.shenyu.agent.api.entity.MethodResult;
+import org.apache.shenyu.agent.api.entity.TargetObject;
+import org.apache.shenyu.agent.api.handler.InstanceMethodHandler;
+import org.apache.shenyu.agent.plugin.metrics.api.constant.MetricsConstant;
+import
org.apache.shenyu.agent.plugin.metrics.common.factory.MetricsRecorderPool;
+import org.springframework.web.server.ServerWebExchange;
+
+import java.lang.reflect.Method;
+
+/**
+ * The type metrics prometheus grpc plugin, about apache dubbo or alibaba
dubbo, handler.
+ */
+public class PrometheusGrpcPluginHandler implements InstanceMethodHandler {
+
+ @Override
+ public void before(final TargetObject target, final Method method, final
Object[] args, final MethodResult result) {
+ final ServerWebExchange exchange = (ServerWebExchange) args[0];
+ final String path = exchange.getRequest().getURI().getPath();
+
+ MetricsRecorderPool.get(MetricsConstant.GRPC_REQUEST_TOTAL,
MetricsConstant.PROMETHEUS)
+ .ifPresent(metricsRecorder -> metricsRecorder.inc(path));
+ }
+
+}
diff --git
a/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusMotanPluginHandler.java
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusMotanPluginHandler.java
new file mode 100644
index 0000000..63470a9
--- /dev/null
+++
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusMotanPluginHandler.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.agent.plugin.metrics.prometheus.handler;
+
+import org.apache.shenyu.agent.api.entity.MethodResult;
+import org.apache.shenyu.agent.api.entity.TargetObject;
+import org.apache.shenyu.agent.api.handler.InstanceMethodHandler;
+import org.apache.shenyu.agent.plugin.metrics.api.constant.MetricsConstant;
+import
org.apache.shenyu.agent.plugin.metrics.common.factory.MetricsRecorderPool;
+import org.springframework.web.server.ServerWebExchange;
+
+import java.lang.reflect.Method;
+
+/**
+ * The type metrics prometheus motan plugin, about apache dubbo or alibaba
dubbo, handler.
+ */
+public class PrometheusMotanPluginHandler implements InstanceMethodHandler {
+
+ @Override
+ public void before(final TargetObject target, final Method method, final
Object[] args, final MethodResult result) {
+ final ServerWebExchange exchange = (ServerWebExchange) args[0];
+ final String path = exchange.getRequest().getURI().getPath();
+
+ MetricsRecorderPool.get(MetricsConstant.MOTAN_REQUEST_TOTAL,
MetricsConstant.PROMETHEUS)
+ .ifPresent(metricsRecorder -> metricsRecorder.inc(path));
+ }
+
+}
diff --git
a/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusSofaPluginHandler.java
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusSofaPluginHandler.java
new file mode 100644
index 0000000..d0296ab
--- /dev/null
+++
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusSofaPluginHandler.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.agent.plugin.metrics.prometheus.handler;
+
+import org.apache.shenyu.agent.api.entity.MethodResult;
+import org.apache.shenyu.agent.api.entity.TargetObject;
+import org.apache.shenyu.agent.api.handler.InstanceMethodHandler;
+import org.apache.shenyu.agent.plugin.metrics.api.constant.MetricsConstant;
+import
org.apache.shenyu.agent.plugin.metrics.common.factory.MetricsRecorderPool;
+import org.springframework.web.server.ServerWebExchange;
+
+import java.lang.reflect.Method;
+
+/**
+ * The type metrics prometheus sofa plugin, about apache dubbo or alibaba
dubbo, handler.
+ */
+public class PrometheusSofaPluginHandler implements InstanceMethodHandler {
+
+ @Override
+ public void before(final TargetObject target, final Method method, final
Object[] args, final MethodResult result) {
+ final ServerWebExchange exchange = (ServerWebExchange) args[0];
+ final String path = exchange.getRequest().getURI().getPath();
+
+ MetricsRecorderPool.get(MetricsConstant.SOFA_REQUEST_TOTAL,
MetricsConstant.PROMETHEUS)
+ .ifPresent(metricsRecorder -> metricsRecorder.inc(path));
+ }
+
+}
diff --git
a/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusSpringCloudPluginHandler.java
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusSpringCloudPluginHandler.java
new file mode 100644
index 0000000..e5f04b5
--- /dev/null
+++
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusSpringCloudPluginHandler.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.agent.plugin.metrics.prometheus.handler;
+
+import org.apache.shenyu.agent.api.entity.MethodResult;
+import org.apache.shenyu.agent.api.entity.TargetObject;
+import org.apache.shenyu.agent.api.handler.InstanceMethodHandler;
+import org.apache.shenyu.agent.plugin.metrics.api.constant.MetricsConstant;
+import
org.apache.shenyu.agent.plugin.metrics.common.factory.MetricsRecorderPool;
+import org.springframework.web.server.ServerWebExchange;
+
+import java.lang.reflect.Method;
+
+/**
+ * The type metrics prometheus spring cloud plugin, about apache dubbo or
alibaba dubbo, handler.
+ */
+public class PrometheusSpringCloudPluginHandler implements
InstanceMethodHandler {
+
+ @Override
+ public void before(final TargetObject target, final Method method, final
Object[] args, final MethodResult result) {
+ final ServerWebExchange exchange = (ServerWebExchange) args[0];
+ final String path = exchange.getRequest().getURI().getPath();
+
+ MetricsRecorderPool.get(MetricsConstant.SPRING_CLOUD_REQUEST_TOTAL,
MetricsConstant.PROMETHEUS)
+ .ifPresent(metricsRecorder -> metricsRecorder.inc(path));
+ }
+
+}
diff --git
a/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusTarsPluginHandler.java
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusTarsPluginHandler.java
new file mode 100644
index 0000000..7d83813
--- /dev/null
+++
b/shenyu-agent/shenyu-agent-plugins/shenyu-agent-plugin-metrics/shenyu-agent-plugin-metrics-prometheus/src/main/java/org/apache/shenyu/agent/plugin/metrics/prometheus/handler/PrometheusTarsPluginHandler.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.agent.plugin.metrics.prometheus.handler;
+
+import org.apache.shenyu.agent.api.entity.MethodResult;
+import org.apache.shenyu.agent.api.entity.TargetObject;
+import org.apache.shenyu.agent.api.handler.InstanceMethodHandler;
+import org.apache.shenyu.agent.plugin.metrics.api.constant.MetricsConstant;
+import
org.apache.shenyu.agent.plugin.metrics.common.factory.MetricsRecorderPool;
+import org.springframework.web.server.ServerWebExchange;
+
+import java.lang.reflect.Method;
+
+/**
+ * The type metrics prometheus tars plugin, about apache dubbo or alibaba
dubbo, handler.
+ */
+public class PrometheusTarsPluginHandler implements InstanceMethodHandler {
+
+ @Override
+ public void before(final TargetObject target, final Method method, final
Object[] args, final MethodResult result) {
+ final ServerWebExchange exchange = (ServerWebExchange) args[0];
+ final String path = exchange.getRequest().getURI().getPath();
+
+ MetricsRecorderPool.get(MetricsConstant.TARS_REQUEST_TOTAL,
MetricsConstant.PROMETHEUS)
+ .ifPresent(metricsRecorder -> metricsRecorder.inc(path));
+ }
+
+}
diff --git
a/shenyu-dist/shenyu-agent-dist/src/main/resources/conf/metrics-meta.yaml
b/shenyu-dist/shenyu-agent-dist/src/main/resources/conf/metrics-meta.yaml
index 295c9b7..9423225 100644
--- a/shenyu-dist/shenyu-agent-dist/src/main/resources/conf/metrics-meta.yaml
+++ b/shenyu-dist/shenyu-agent-dist/src/main/resources/conf/metrics-meta.yaml
@@ -19,21 +19,60 @@ metrics:
- name: shenyu_request_total
type: counter
help: ShenYu gateway request total.
+
- name: shenyu_request_throw_total
type: counter
help: ShenYu gateway request total when an exception occurs.
+
- name: shenyu_http_request_total
type: counter
labelNames:
- path
- method
help: ShenYu gateway request total of http.
+
+ - name: shenyu_dubbo_request_total
+ type: counter
+ labelNames:
+ - path
+ help: ShenYu gateway request total of dubbo.
+
+ - name: shenyu_grpc_request_total
+ type: counter
+ labelNames:
+ - path
+ help: ShenYu gateway request total of grpc.
+
+ - name: shenyu_motan_request_total
+ type: counter
+ labelNames:
+ - path
+ help: ShenYu gateway request total of motan.
+
+ - name: shenyu_sofa_request_total
+ type: counter
+ labelNames:
+ - path
+ help: ShenYu gateway request total of sofa.
+
+ - name: shenyu_tars_request_total
+ type: counter
+ labelNames:
+ - path
+ help: ShenYu gateway request total of tars.
+
+ - name: shenyu_spring_cloud_request_total
+ type: counter
+ labelNames:
+ - path
+ help: ShenYu gateway request total of spring cloud.
+
- name: shenyu_request_undone
type: gauge
help: ShenYu gateway request is not completed.
+
- name: shenyu_execute_latency_millis
type: histogram
labelNames:
- path
- help: ShenYu gateway execute time interval.
-
+ help: ShenYu gateway execute time interval.
\ No newline at end of file
diff --git
a/shenyu-dist/shenyu-agent-dist/src/main/resources/conf/metrics-point.yaml
b/shenyu-dist/shenyu-agent-dist/src/main/resources/conf/metrics-point.yaml
index c8fe705..8da1978 100644
--- a/shenyu-dist/shenyu-agent-dist/src/main/resources/conf/metrics-point.yaml
+++ b/shenyu-dist/shenyu-agent-dist/src/main/resources/conf/metrics-point.yaml
@@ -29,4 +29,53 @@ pointCuts:
name: doExecute
handlers:
prometheus:
- -
org.apache.shenyu.agent.plugin.metrics.prometheus.handler.PrometheusDividePluginHandler
\ No newline at end of file
+ -
org.apache.shenyu.agent.plugin.metrics.prometheus.handler.PrometheusDividePluginHandler
+ - targetClass: org.apache.shenyu.plugin.alibaba.dubbo.AlibabaDubboPlugin
+ points:
+ - type: instanceMethod
+ name: doDubboInvoker
+ handlers:
+ prometheus:
+ -
org.apache.shenyu.agent.plugin.metrics.prometheus.handler.PrometheusDubboPluginHandler
+ - targetClass: org.apache.shenyu.plugin.apache.dubbo.ApacheDubboPlugin
+ points:
+ - type: instanceMethod
+ name: doDubboInvoker
+ handlers:
+ prometheus:
+ -
org.apache.shenyu.agent.plugin.metrics.prometheus.handler.PrometheusDubboPluginHandler
+ - targetClass: org.apache.shenyu.plugin.grpc.GrpcPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ prometheus:
+ -
org.apache.shenyu.agent.plugin.metrics.prometheus.handler.PrometheusGrpcPluginHandler
+ - targetClass: org.apache.shenyu.plugin.motan.MotanPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ prometheus:
+ -
org.apache.shenyu.agent.plugin.metrics.prometheus.handler.PrometheusMotanPluginHandler
+ - targetClass: org.apache.shenyu.plugin.sofa.SofaPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ prometheus:
+ -
org.apache.shenyu.agent.plugin.metrics.prometheus.handler.PrometheusSofaPluginHandler
+ - targetClass: org.apache.shenyu.plugin.tars.TarsPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ prometheus:
+ -
org.apache.shenyu.agent.plugin.metrics.prometheus.handler.PrometheusTarsPluginHandler
+ - targetClass: org.apache.shenyu.plugin.springcloud.SpringCloudPlugin
+ points:
+ - type: instanceMethod
+ name: doExecute
+ handlers:
+ prometheus:
+ -
org.apache.shenyu.agent.plugin.metrics.prometheus.handler.PrometheusSpringCloudPluginHandler
\ No newline at end of file