[dubbo] branch 3.2 updated: Metrics default val set 0 (#12379)

2023-05-23 Thread songxiaosheng
This is an automated email from the ASF dual-hosted git repository.

songxiaosheng pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.2 by this push:
 new d2391d2abd Metrics default val set 0 (#12379)
d2391d2abd is described below

commit d2391d2abde386dbf6387d02667ed8f2cb23939c
Author: wxbty <38374721+wx...@users.noreply.github.com>
AuthorDate: Wed May 24 13:48:43 2023 +0800

Metrics default val set 0 (#12379)

* add comment

* use dubbo nullable

* fill default 0

* add licence

* fix ci

* fix ci

* fix ci

* add comment

* fix ci

* fix ci

* modify warn

-

Co-authored-by: x-shadow-man <1494445...@qq.com>
Co-authored-by: songxiaosheng 
---
 .../dubbo/metrics/data/MethodStatComposite.java| 16 --
 .../dubbo/metrics/data/ServiceStatComposite.java   |  3 ++
 .../apache/dubbo/metrics/model/MetricsSupport.java | 27 --
 .../dubbo/metrics/model/key/CategoryOverall.java   |  3 +-
 .../apache/dubbo/metrics/model/key/MetricsCat.java | 13 -
 .../apache/dubbo/metrics/model/key/MetricsKey.java |  6 ---
 .../dubbo/metrics/model/key/MetricsKeyWrapper.java | 15 ++
 .../apache/dubbo/metrics/MetricsSupportTest.java   | 59 ++
 .../org/apache/dubbo/metrics/DefaultConstants.java |  6 ++-
 .../dubbo/metrics/event/DefaultSubDispatcher.java  | 12 +
 .../metrics/collector/DefaultCollectorTest.java|  7 +--
 .../dubbo/metrics/filter/MetricsFilterTest.java| 22 
 .../metadata/event/MetadataSubDispatcher.java  |  7 +++
 .../metadata/MetadataMetricsCollectorTest.java |  4 +-
 .../registry/event/RegistrySubDispatcher.java  |  7 +++
 .../collector/RegistryMetricsCollectorTest.java| 22 
 16 files changed, 177 insertions(+), 52 deletions(-)

diff --git 
a/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/data/MethodStatComposite.java
 
b/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/data/MethodStatComposite.java
index 7b029e8f95..a4c6bba709 100644
--- 
a/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/data/MethodStatComposite.java
+++ 
b/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/data/MethodStatComposite.java
@@ -17,9 +17,13 @@
 
 package org.apache.dubbo.metrics.data;
 
+import org.apache.dubbo.common.logger.Logger;
+import org.apache.dubbo.common.logger.LoggerFactory;
 import org.apache.dubbo.common.utils.CollectionUtils;
+import org.apache.dubbo.metrics.exception.MetricsNeverHappenException;
 import org.apache.dubbo.metrics.model.MethodMetric;
 import org.apache.dubbo.metrics.model.MetricsCategory;
+import org.apache.dubbo.metrics.model.MetricsSupport;
 import org.apache.dubbo.metrics.model.key.MetricsKeyWrapper;
 import org.apache.dubbo.metrics.model.sample.CounterMetricSample;
 import org.apache.dubbo.metrics.model.sample.GaugeMetricSample;
@@ -41,9 +45,12 @@ import java.util.concurrent.atomic.AtomicLong;
  */
 public class MethodStatComposite extends AbstractMetricsExport {
 
+private static final Logger logger = 
LoggerFactory.getLogger(MethodStatComposite.class);
+
 public MethodStatComposite(ApplicationModel applicationModel) {
 super(applicationModel);
 }
+
 private final Map> 
methodNumStats = new ConcurrentHashMap<>();
 
 public void initWrapper(List metricsKeyWrappers) {
@@ -58,6 +65,7 @@ public class MethodStatComposite extends 
AbstractMetricsExport {
 return;
 }
 methodNumStats.get(wrapper).computeIfAbsent(new 
MethodMetric(getApplicationModel(), invocation), k -> new 
AtomicLong(0L)).getAndAdd(size);
+MetricsSupport.fillZero(methodNumStats);
 }
 
 public List export(MetricsCategory category) {
@@ -65,11 +73,13 @@ public class MethodStatComposite extends 
AbstractMetricsExport {
 for (MetricsKeyWrapper wrapper : methodNumStats.keySet()) {
 Map stringAtomicLongMap = 
methodNumStats.get(wrapper);
 for (MethodMetric methodMetric : stringAtomicLongMap.keySet()) {
-if (methodMetric.getSampleType() == MetricSample.Type.GAUGE) {
+if (wrapper.getSampleType() == MetricSample.Type.COUNTER) {
 list.add(new CounterMetricSample<>(wrapper,
-methodMetric.getTags(), category, 
stringAtomicLongMap.get(methodMetric)));
-} else {
+methodMetric.getTags(), category, 
stringAtomicLongMap.get(methodMetric)));
+} else if (wrapper.getSampleType() == MetricSample.Type.GAUGE) 
{
 list.add(new GaugeMetricSample<>(wrapper, 
methodMetric.getTags(), category, stringAtomicLongMap, value -> 
value.get(methodMetric).get()));
+} else {
+throw new MetricsNeverHappenExcepti

[dubbo-admin] branch refactor-with-go updated: feat: Routing rules page, add a jump link to the official website description and initialize some pages (#1137)

2023-05-23 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch refactor-with-go
in repository https://gitbox.apache.org/repos/asf/dubbo-admin.git


The following commit(s) were added to refs/heads/refactor-with-go by this push:
 new ad60161c feat: Routing rules page, add a jump link to the official 
website description and initialize some pages (#1137)
ad60161c is described below

commit ad60161c82294f168e2ed540a0281e20822bac75
Author: SDUWYS <91682295+sdu...@users.noreply.github.com>
AuthorDate: Wed May 24 09:47:14 2023 +0800

feat: Routing rules page, add a jump link to the official website 
description and initialize some pages (#1137)
---
 .../src/components/governance/AccessControl.vue|   6 +-
 .../src/components/governance/LoadBalance.vue  |   4 --
 .../src/components/governance/MeshRule.vue |   6 --
 .../src/components/governance/Overrides.vue|   3 +
 .../src/components/governance/RoutingRule.vue  |   5 +-
 .../src/components/governance/TagRule.vue  |   5 +-
 .../src/components/governance/WeightAdjust.vue |   4 --
 .../src/components/public/assets/link.png  | Bin 0 -> 5096 bytes
 .../src/components/traffic/Accesslog.vue   |  44 
 .../src/components/traffic/Arguments.vue   |  44 
 dubbo-admin-ui/src/components/traffic/Host.vue |  44 
 .../src/components/traffic/Isolation.vue   |  44 
 dubbo-admin-ui/src/components/traffic/Mock.vue |  44 
 dubbo-admin-ui/src/components/traffic/Region.vue   |  44 
 dubbo-admin-ui/src/components/traffic/Retry.vue|  44 
 dubbo-admin-ui/src/components/traffic/Timeout.vue  |  44 
 dubbo-admin-ui/src/components/traffic/Weight.vue   |  44 
 dubbo-admin-ui/src/mock/mockServer.js  |   2 +
 dubbo-admin-ui/src/router/index.js |  74 +
 19 files changed, 482 insertions(+), 23 deletions(-)

diff --git a/dubbo-admin-ui/src/components/governance/AccessControl.vue 
b/dubbo-admin-ui/src/components/governance/AccessControl.vue
index f8070417..b4d91d2c 100644
--- a/dubbo-admin-ui/src/components/governance/AccessControl.vue
+++ b/dubbo-admin-ui/src/components/governance/AccessControl.vue
@@ -265,8 +265,6 @@
 
 
 
-import AceEditor from '@/components/public/AceEditor'
-import Search from '@/components/public/Search'
 import Breadcrumb from '@/components/public/Breadcrumb'
 
 export default {
@@ -621,9 +619,7 @@ export default {
 }
   },
   components: {
-Breadcrumb,
-AceEditor,
-Search
+Breadcrumb
   }
 }
 
diff --git a/dubbo-admin-ui/src/components/governance/LoadBalance.vue 
b/dubbo-admin-ui/src/components/governance/LoadBalance.vue
index 5f4a95b2..b76960d5 100644
--- a/dubbo-admin-ui/src/components/governance/LoadBalance.vue
+++ b/dubbo-admin-ui/src/components/governance/LoadBalance.vue
@@ -215,14 +215,10 @@
 
 
 
-import AceEditor from '@/components/public/AceEditor'
-import Search from '@/components/public/Search'
 import Breadcrumb from '@/components/public/Breadcrumb'
 
 export default {
   components: {
-AceEditor,
-Search,
 Breadcrumb
   },
   data: () => ({
diff --git a/dubbo-admin-ui/src/components/governance/MeshRule.vue 
b/dubbo-admin-ui/src/components/governance/MeshRule.vue
index 5b949dbc..5f1d6d16 100644
--- a/dubbo-admin-ui/src/components/governance/MeshRule.vue
+++ b/dubbo-admin-ui/src/components/governance/MeshRule.vue
@@ -137,15 +137,11 @@