This is an automated email from the ASF dual-hosted git repository.
panjuan 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 66d33a1f60a Rename MetricsWrapper to MetricsCollector (#23616)
66d33a1f60a is described below
commit 66d33a1f60a4fa4fc055f56a13057932005e38a5
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Jan 17 20:58:55 2023 +0800
Rename MetricsWrapper to MetricsCollector (#23616)
---
.../core/advice/RouteResultCountAdvice.java | 8 ++---
.../metrics/core/advice/SQLParseCountAdvice.java | 28 ++++++++--------
.../metrics/core/advice/SQLRouteCountAdvice.java | 12 +++----
.../proxy/CommitTransactionsCountAdvice.java | 6 ++--
.../proxy/CurrentConnectionsCountAdvice.java | 8 ++---
.../advice/proxy/ExecuteErrorsCountAdvice.java | 6 ++--
.../proxy/ExecuteLatencyHistogramAdvice.java | 6 ++--
.../core/advice/proxy/RequestsCountAdvice.java | 6 ++--
.../proxy/RollbackTransactionsCountAdvice.java | 6 ++--
.../{MetricsWrapper.java => MetricsCollector.java} | 4 +--
...erFactory.java => MetricsCollectorFactory.java} | 12 +++----
...Registry.java => MetricsCollectorRegistry.java} | 26 +++++++--------
...csWrapper.java => CounterMetricsCollector.java} | 6 ++--
...ricsWrapper.java => GaugeMetricsCollector.java} | 6 ++--
...Wrapper.java => HistogramMetricsCollector.java} | 6 ++--
...csWrapper.java => SummaryMetricsCollector.java} | 6 ++--
...Test.java => MetricsCollectorRegistryTest.java} | 12 +++----
...sWrapperTest.java => MetricsCollectorTest.java} | 30 ++++++++---------
.../metrics/core/advice/MetricsAdviceBaseTest.java | 6 ++--
.../core/advice/RouteResultCountAdviceTest.java | 12 +++----
.../core/advice/SQLParseCountAdviceTest.java | 30 ++++++++---------
.../core/advice/SQLRouteCountAdviceTest.java | 14 ++++----
.../proxy/CommitTransactionsCountAdviceTest.java | 8 ++---
.../proxy/CurrentConnectionsCountAdviceTest.java | 8 ++---
.../advice/proxy/ExecuteErrorsCountAdviceTest.java | 8 ++---
.../proxy/ExecuteLatencyHistogramAdviceTest.java | 8 ++---
.../core/advice/proxy/RequestsCountAdviceTest.java | 8 ++---
.../proxy/RollbackTransactionsCountAdviceTest.java | 8 ++---
...erFactory.java => FixtureCollectorFactory.java} | 10 +++---
...reWrapper.java => FixtureMetricsCollector.java} | 12 +++----
.../PrometheusPluginLifecycleService.java | 6 ++--
.../prometheus/collector/BuildInfoCollector.java | 4 +--
.../proxy/ProxyMetaDataInfoCollector.java | 4 +--
.../collector/proxy/ProxyStateCollector.java | 4 +--
...actory.java => PrometheusCollectorFactory.java} | 38 +++++++++++-----------
...rapper.java => PrometheusCounterCollector.java} | 4 +--
...eWrapper.java => PrometheusGaugeCollector.java} | 4 +--
...pper.java => PrometheusHistogramCollector.java} | 4 +--
...rapper.java => PrometheusSummaryCollector.java} | 4 +--
.../wrapper/PrometheusWrapperFactoryTest.java | 20 ++++++------
.../wrapper/type/PrometheusCounterWrapperTest.java | 4 +--
.../wrapper/type/PrometheusGaugeWrapperTest.java | 4 +--
.../type/PrometheusHistogramWrapperTest.java | 4 +--
.../wrapper/type/PrometheusSummaryWrapperTest.java | 4 +--
44 files changed, 217 insertions(+), 217 deletions(-)
diff --git
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdvice.java
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdvice.java
index 5974881f610..8c589ab3cec 100644
---
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdvice.java
+++
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdvice.java
@@ -19,8 +19,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice;
import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
import org.apache.shardingsphere.infra.route.context.RouteContext;
import org.apache.shardingsphere.infra.route.context.RouteMapper;
import org.apache.shardingsphere.infra.route.context.RouteUnit;
@@ -43,8 +43,8 @@ public final class RouteResultCountAdvice implements
InstanceMethodAdvice {
}
for (RouteUnit each : ((RouteContext) result).getRouteUnits()) {
RouteMapper dataSourceMapper = each.getDataSourceMapper();
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(ROUTED_DATA_SOURCES_METRIC_KEY).inc(dataSourceMapper.getActualName());
- each.getTableMappers().forEach(table ->
MetricsWrapperRegistry.<CounterMetricsWrapper>get(ROUTED_TABLES_METRIC_KEY).inc(table.getActualName()));
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(ROUTED_DATA_SOURCES_METRIC_KEY).inc(dataSourceMapper.getActualName());
+ each.getTableMappers().forEach(table ->
MetricsCollectorRegistry.<CounterMetricsCollector>get(ROUTED_TABLES_METRIC_KEY).inc(table.getActualName()));
}
}
}
diff --git
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdvice.java
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdvice.java
index f9e415153dd..290f692320a 100644
---
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdvice.java
+++
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdvice.java
@@ -19,8 +19,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice;
import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
import org.apache.shardingsphere.distsql.parser.statement.ral.RALStatement;
import org.apache.shardingsphere.distsql.parser.statement.rdl.RDLStatement;
import org.apache.shardingsphere.distsql.parser.statement.rql.RQLStatement;
@@ -75,33 +75,33 @@ public final class SQLParseCountAdvice implements
InstanceMethodAdvice {
private void countSQL(final SQLStatement sqlStatement) {
if (sqlStatement instanceof InsertStatement) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(PARSED_INSERT_SQL_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(PARSED_INSERT_SQL_METRIC_KEY).inc();
} else if (sqlStatement instanceof UpdateStatement) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(PARSED_UPDATE_SQL_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(PARSED_UPDATE_SQL_METRIC_KEY).inc();
} else if (sqlStatement instanceof DeleteStatement) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(PARSED_DELETE_SQL_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(PARSED_DELETE_SQL_METRIC_KEY).inc();
} else if (sqlStatement instanceof SelectStatement) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(PARSED_SELECT_SQL_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(PARSED_SELECT_SQL_METRIC_KEY).inc();
} else if (sqlStatement instanceof DDLStatement) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(PARSED_DDL_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(PARSED_DDL_METRIC_KEY).inc();
} else if (sqlStatement instanceof DCLStatement) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(PARSED_DCL_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(PARSED_DCL_METRIC_KEY).inc();
} else if (sqlStatement instanceof DALStatement) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(PARSED_DAL_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(PARSED_DAL_METRIC_KEY).inc();
} else if (sqlStatement instanceof TCLStatement) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(PARSED_TCL_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(PARSED_TCL_METRIC_KEY).inc();
}
}
private void countDistSQL(final SQLStatement sqlStatement) {
if (sqlStatement instanceof RQLStatement) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(PARSED_RQL_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(PARSED_RQL_METRIC_KEY).inc();
} else if (sqlStatement instanceof RDLStatement) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(PARSED_RDL_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(PARSED_RDL_METRIC_KEY).inc();
} else if (sqlStatement instanceof RALStatement) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(PARSED_RAL_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(PARSED_RAL_METRIC_KEY).inc();
} else if (sqlStatement instanceof RULStatement) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(PARSED_RUL_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(PARSED_RUL_METRIC_KEY).inc();
}
}
}
diff --git
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdvice.java
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdvice.java
index 24a9e36da95..24ec981e0b5 100644
---
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdvice.java
+++
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdvice.java
@@ -19,8 +19,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice;
import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
import org.apache.shardingsphere.infra.binder.QueryContext;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
import
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.DeleteStatement;
@@ -48,13 +48,13 @@ public final class SQLRouteCountAdvice implements
InstanceMethodAdvice {
QueryContext queryContext = (QueryContext) args[1];
SQLStatement sqlStatement =
queryContext.getSqlStatementContext().getSqlStatement();
if (sqlStatement instanceof InsertStatement) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(ROUTED_INSERT_SQL_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(ROUTED_INSERT_SQL_METRIC_KEY).inc();
} else if (sqlStatement instanceof UpdateStatement) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(ROUTED_UPDATE_SQL_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(ROUTED_UPDATE_SQL_METRIC_KEY).inc();
} else if (sqlStatement instanceof DeleteStatement) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(ROUTED_DELETE_SQL_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(ROUTED_DELETE_SQL_METRIC_KEY).inc();
} else if (sqlStatement instanceof SelectStatement) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(ROUTED_SELECT_SQL_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(ROUTED_SELECT_SQL_METRIC_KEY).inc();
}
}
}
diff --git
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdvice.java
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdvice.java
index 597f1a629a8..a71e8d27951 100644
---
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdvice.java
+++
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdvice.java
@@ -19,8 +19,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
import java.lang.reflect.Method;
@@ -33,6 +33,6 @@ public final class CommitTransactionsCountAdvice implements
InstanceMethodAdvice
@Override
public void beforeMethod(final TargetAdviceObject target, final Method
method, final Object[] args) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(PROXY_COMMIT_TRANSACTIONS_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(PROXY_COMMIT_TRANSACTIONS_METRIC_KEY).inc();
}
}
diff --git
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdvice.java
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdvice.java
index d5ce8f85a74..15fbd4ba91c 100644
---
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdvice.java
+++
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdvice.java
@@ -19,8 +19,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.GaugeMetricsWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.GaugeMetricsCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
import java.lang.reflect.Method;
@@ -35,10 +35,10 @@ public final class CurrentConnectionsCountAdvice implements
InstanceMethodAdvice
public void beforeMethod(final TargetAdviceObject target, final Method
method, final Object[] args) {
switch (method.getName()) {
case "channelActive":
-
MetricsWrapperRegistry.<GaugeMetricsWrapper>get(PROXY_CURRENT_CONNECTIONS_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<GaugeMetricsCollector>get(PROXY_CURRENT_CONNECTIONS_METRIC_KEY).inc();
break;
case "channelInactive":
-
MetricsWrapperRegistry.<GaugeMetricsWrapper>get(PROXY_CURRENT_CONNECTIONS_METRIC_KEY).dec();
+
MetricsCollectorRegistry.<GaugeMetricsCollector>get(PROXY_CURRENT_CONNECTIONS_METRIC_KEY).dec();
break;
default:
break;
diff --git
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdvice.java
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdvice.java
index 38cf1e75379..b3d2e200ed6 100644
---
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdvice.java
+++
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdvice.java
@@ -19,8 +19,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
import java.lang.reflect.Method;
@@ -33,6 +33,6 @@ public final class ExecuteErrorsCountAdvice implements
InstanceMethodAdvice {
@Override
public void afterMethod(final TargetAdviceObject target, final Method
method, final Object[] args, final Object result) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(PROXY_EXECUTE_ERRORS_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(PROXY_EXECUTE_ERRORS_METRIC_KEY).inc();
}
}
diff --git
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdvice.java
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdvice.java
index a2e1178878d..00fe8e9f9ad 100644
---
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdvice.java
+++
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdvice.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice;
import org.apache.shardingsphere.agent.plugin.core.recorder.MethodTimeRecorder;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.HistogramMetricsWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.HistogramMetricsCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
import java.lang.reflect.Method;
@@ -41,6 +41,6 @@ public final class ExecuteLatencyHistogramAdvice implements
InstanceMethodAdvice
@Override
public void afterMethod(final TargetAdviceObject target, final Method
method, final Object[] args, final Object result) {
-
MetricsWrapperRegistry.<HistogramMetricsWrapper>get(PROXY_EXECUTE_LATENCY_MILLIS_METRIC_KEY).observe(methodTimeRecorder.getElapsedTimeAndClean(method));
+
MetricsCollectorRegistry.<HistogramMetricsCollector>get(PROXY_EXECUTE_LATENCY_MILLIS_METRIC_KEY).observe(methodTimeRecorder.getElapsedTimeAndClean(method));
}
}
diff --git
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdvice.java
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdvice.java
index 2adbc3295ce..0c779f41d15 100644
---
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdvice.java
+++
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdvice.java
@@ -19,8 +19,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
import java.lang.reflect.Method;
@@ -33,6 +33,6 @@ public final class RequestsCountAdvice implements
InstanceMethodAdvice {
@Override
public void beforeMethod(final TargetAdviceObject target, final Method
method, final Object[] args) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(PROXY_REQUESTS_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(PROXY_REQUESTS_METRIC_KEY).inc();
}
}
diff --git
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdvice.java
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdvice.java
index 4e4e037c110..c02da86c462 100644
---
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdvice.java
+++
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdvice.java
@@ -19,8 +19,8 @@ package
org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
import java.lang.reflect.Method;
@@ -33,6 +33,6 @@ public final class RollbackTransactionsCountAdvice implements
InstanceMethodAdvi
@Override
public void beforeMethod(final TargetAdviceObject target, final Method
method, final Object[] args) {
-
MetricsWrapperRegistry.<CounterMetricsWrapper>get(PROXY_ROLLBACK_TRANSACTIONS_METRIC_KEY).inc();
+
MetricsCollectorRegistry.<CounterMetricsCollector>get(PROXY_ROLLBACK_TRANSACTIONS_METRIC_KEY).inc();
}
}
diff --git
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsWrapper.java
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsCollector.java
similarity index 93%
rename from
agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsWrapper.java
rename to
agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsCollector.java
index ba77d990da6..23765f7a13c 100644
---
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsWrapper.java
+++
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsCollector.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.wrapper;
/**
- * Metrics wrapper.
+ * Metrics collector.
*/
-public interface MetricsWrapper {
+public interface MetricsCollector {
}
diff --git
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsWrapperFactory.java
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsCollectorFactory.java
similarity index 81%
rename from
agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsWrapperFactory.java
rename to
agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsCollectorFactory.java
index 62f3f059648..3e835ac0610 100644
---
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsWrapperFactory.java
+++
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsCollectorFactory.java
@@ -18,15 +18,15 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.wrapper;
/**
- * Metrics wrapper factory.
+ * Metrics collector factory.
*/
-public interface MetricsWrapperFactory {
+public interface MetricsCollectorFactory {
/**
- * Create metrics wrapper.
+ * Create metrics collector.
*
- * @param id metrics wrapper ID
- * @return metrics wrapper
+ * @param id metrics ID
+ * @return metrics collector
*/
- MetricsWrapper create(String id);
+ MetricsCollector create(String id);
}
diff --git
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsWrapperRegistry.java
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsCollectorRegistry.java
similarity index 62%
rename from
agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsWrapperRegistry.java
rename to
agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsCollectorRegistry.java
index c02595d04e8..d2550910648 100644
---
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsWrapperRegistry.java
+++
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/MetricsCollectorRegistry.java
@@ -21,34 +21,34 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
- * Metrics wrapper registry.
+ * Metrics collector registry.
*/
-public final class MetricsWrapperRegistry {
+public final class MetricsCollectorRegistry {
- private static final Map<String, MetricsWrapper> METRICS_WRAPPERS = new
ConcurrentHashMap<>();
+ private static final Map<String, MetricsCollector> METRICS_WRAPPERS = new
ConcurrentHashMap<>();
- private static MetricsWrapperFactory metricsWrapperFactory;
+ private static MetricsCollectorFactory metricsCollectorFactory;
/**
- * Set metrics wrapper factory.
+ * Set metrics collector factory.
*
- * @param metricsWrapperFactory metrics wrapper factory
+ * @param metricsCollectorFactory metrics collector factory
*/
- public static void setMetricsFactory(final MetricsWrapperFactory
metricsWrapperFactory) {
- MetricsWrapperRegistry.metricsWrapperFactory = metricsWrapperFactory;
+ public static void setMetricsFactory(final MetricsCollectorFactory
metricsCollectorFactory) {
+ MetricsCollectorRegistry.metricsCollectorFactory =
metricsCollectorFactory;
}
/**
- * Get metrics wrapper.
+ * Get metrics collector.
*
* @param id metric ID
- * @param <T> type of metrics wrapper
- * @return metrics wrapper
+ * @param <T> type of metrics collector
+ * @return metrics collector
* @see <a
href="https://bugs.openjdk.java.net/browse/JDK-8161372">JDK-8161372</a>
*/
@SuppressWarnings("unchecked")
- public static <T extends MetricsWrapper> T get(final String id) {
+ public static <T extends MetricsCollector> T get(final String id) {
T result = (T) METRICS_WRAPPERS.get(id);
- return (T) (null == result ? METRICS_WRAPPERS.computeIfAbsent(id,
metricsWrapperFactory::create) : result);
+ return (T) (null == result ? METRICS_WRAPPERS.computeIfAbsent(id,
metricsCollectorFactory::create) : result);
}
}
diff --git
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/CounterMetricsWrapper.java
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/CounterMetricsCollector.java
similarity index 90%
rename from
agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/CounterMetricsWrapper.java
rename to
agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/CounterMetricsCollector.java
index fa085ab329b..2d620a6c499 100644
---
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/CounterMetricsWrapper.java
+++
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/CounterMetricsCollector.java
@@ -17,12 +17,12 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollector;
/**
- * Counter metrics wrapper.
+ * Counter metrics collector.
*/
-public interface CounterMetricsWrapper extends MetricsWrapper {
+public interface CounterMetricsCollector extends MetricsCollector {
/**
* Metric increase.
diff --git
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/GaugeMetricsWrapper.java
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/GaugeMetricsCollector.java
similarity index 92%
rename from
agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/GaugeMetricsWrapper.java
rename to
agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/GaugeMetricsCollector.java
index 4a3a852ea87..39152bbb7fc 100644
---
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/GaugeMetricsWrapper.java
+++
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/GaugeMetricsCollector.java
@@ -17,12 +17,12 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollector;
/**
- * Gauge metrics wrapper.
+ * Gauge metrics collector.
*/
-public interface GaugeMetricsWrapper extends MetricsWrapper {
+public interface GaugeMetricsCollector extends MetricsCollector {
/**
* Metric increase.
diff --git
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/HistogramMetricsWrapper.java
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/HistogramMetricsCollector.java
similarity index 89%
rename from
agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/HistogramMetricsWrapper.java
rename to
agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/HistogramMetricsCollector.java
index 489d28e3bab..8d20789ccb0 100644
---
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/HistogramMetricsWrapper.java
+++
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/HistogramMetricsCollector.java
@@ -17,12 +17,12 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollector;
/**
- * Histogram metrics wrapper.
+ * Histogram metrics collector.
*/
-public interface HistogramMetricsWrapper extends MetricsWrapper {
+public interface HistogramMetricsCollector extends MetricsCollector {
/**
* Observed by value.
diff --git
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/SummaryMetricsWrapper.java
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/SummaryMetricsCollector.java
similarity index 89%
rename from
agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/SummaryMetricsWrapper.java
rename to
agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/SummaryMetricsCollector.java
index 6eb885ddf99..5c3c5e9365e 100644
---
a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/SummaryMetricsWrapper.java
+++
b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/wrapper/type/SummaryMetricsCollector.java
@@ -17,12 +17,12 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollector;
/**
- * Summary metrics wrapper.
+ * Summary metrics collector.
*/
-public interface SummaryMetricsWrapper extends MetricsWrapper {
+public interface SummaryMetricsCollector extends MetricsCollector {
/**
* Observed by value.
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/MetricsWrapperRegistryTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/MetricsCollectorRegistryTest.java
similarity index 79%
rename from
agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/MetricsWrapperRegistryTest.java
rename to
agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/MetricsCollectorRegistryTest.java
index 1d4e5577f59..0f3103439bf 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/MetricsWrapperRegistryTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/MetricsCollectorRegistryTest.java
@@ -17,19 +17,19 @@
package org.apache.shardingsphere.agent.plugin.metrics.core;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureWrapperFactory;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureMetricsCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureCollectorFactory;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
-public final class MetricsWrapperRegistryTest {
+public final class MetricsCollectorRegistryTest {
@Test
public void assertGet() {
- MetricsWrapperRegistry.setMetricsFactory(new FixtureWrapperFactory());
- assertThat(MetricsWrapperRegistry.get("test"),
instanceOf(FixtureWrapper.class));
+ MetricsCollectorRegistry.setMetricsFactory(new
FixtureCollectorFactory());
+ assertThat(MetricsCollectorRegistry.get("test"),
instanceOf(FixtureMetricsCollector.class));
}
}
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/MetricsWrapperTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/MetricsCollectorTest.java
similarity index 56%
rename from
agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/MetricsWrapperTest.java
rename to
agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/MetricsCollectorTest.java
index 81a6fbb572a..45090e495e3 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/MetricsWrapperTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/MetricsCollectorTest.java
@@ -17,28 +17,28 @@
package org.apache.shardingsphere.agent.plugin.metrics.core;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureMetricsCollector;
import org.junit.Test;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-public final class MetricsWrapperTest {
+public final class MetricsCollectorTest {
@Test
public void assertCreate() {
- FixtureWrapper metricsWrapper = new FixtureWrapper();
- metricsWrapper.inc();
- assertThat(metricsWrapper.getFixtureValue(), is(1d));
- metricsWrapper.inc("a");
- assertThat(metricsWrapper.getFixtureValue(), is(2d));
- metricsWrapper.dec();
- assertThat(metricsWrapper.getFixtureValue(), is(1d));
- metricsWrapper.dec("c");
- assertThat(metricsWrapper.getFixtureValue(), is(0d));
- metricsWrapper.observe(2);
- assertThat(metricsWrapper.getFixtureValue(), is(2.0d));
- metricsWrapper.observe(3);
- assertThat(metricsWrapper.getFixtureValue(), is(3.0d));
+ FixtureMetricsCollector fixtureMetricsCollector = new
FixtureMetricsCollector();
+ fixtureMetricsCollector.inc();
+ assertThat(fixtureMetricsCollector.getFixtureValue(), is(1d));
+ fixtureMetricsCollector.inc("a");
+ assertThat(fixtureMetricsCollector.getFixtureValue(), is(2d));
+ fixtureMetricsCollector.dec();
+ assertThat(fixtureMetricsCollector.getFixtureValue(), is(1d));
+ fixtureMetricsCollector.dec("c");
+ assertThat(fixtureMetricsCollector.getFixtureValue(), is(0d));
+ fixtureMetricsCollector.observe(2);
+ assertThat(fixtureMetricsCollector.getFixtureValue(), is(2.0d));
+ fixtureMetricsCollector.observe(3);
+ assertThat(fixtureMetricsCollector.getFixtureValue(), is(3.0d));
}
}
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/MetricsAdviceBaseTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/MetricsAdviceBaseTest.java
index 2f19fb5590b..8bd25145850 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/MetricsAdviceBaseTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/MetricsAdviceBaseTest.java
@@ -17,14 +17,14 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.advice;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureWrapperFactory;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureCollectorFactory;
import org.junit.BeforeClass;
public abstract class MetricsAdviceBaseTest {
@BeforeClass
public static void setup() {
- MetricsWrapperRegistry.setMetricsFactory(new FixtureWrapperFactory());
+ MetricsCollectorRegistry.setMetricsFactory(new
FixtureCollectorFactory());
}
}
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdviceTest.java
index 1c02ce5206f..8632b748120 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdviceTest.java
@@ -17,8 +17,8 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.advice;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureMetricsCollector;
import org.apache.shardingsphere.infra.route.context.RouteContext;
import org.apache.shardingsphere.infra.route.context.RouteMapper;
import org.apache.shardingsphere.infra.route.context.RouteUnit;
@@ -36,8 +36,8 @@ public final class RouteResultCountAdviceTest extends
MetricsAdviceBaseTest {
@After
public void reset() {
- ((FixtureWrapper)
MetricsWrapperRegistry.get("routed_data_sources_total")).reset();
- ((FixtureWrapper)
MetricsWrapperRegistry.get("routed_tables_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("routed_data_sources_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("routed_tables_total")).reset();
}
@Test
@@ -47,9 +47,9 @@ public final class RouteResultCountAdviceTest extends
MetricsAdviceBaseTest {
RouteMapper tableMapper = new RouteMapper("t_order", "t_order_0");
routeContext.getRouteUnits().add(new RouteUnit(dataSourceMapper,
Collections.singleton(tableMapper)));
new RouteResultCountAdvice().afterMethod(new MockTargetAdviceObject(),
mock(Method.class), new Object[]{}, routeContext);
- FixtureWrapper wrapper =
MetricsWrapperRegistry.get("routed_data_sources_total");
+ FixtureMetricsCollector wrapper =
MetricsCollectorRegistry.get("routed_data_sources_total");
assertThat(wrapper.getFixtureValue(), is(1d));
- wrapper = MetricsWrapperRegistry.get("routed_tables_total");
+ wrapper = MetricsCollectorRegistry.get("routed_tables_total");
assertThat(wrapper.getFixtureValue(), is(1d));
}
}
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdviceTest.java
index 7cb81400a31..44c4a076370 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdviceTest.java
@@ -17,8 +17,8 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.advice;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureMetricsCollector;
import
org.apache.shardingsphere.distsql.parser.statement.rdl.create.RegisterStorageUnitStatement;
import
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowStorageUnitsStatement;
import
org.apache.shardingsphere.distsql.parser.statement.rul.sql.FormatStatement;
@@ -47,18 +47,18 @@ public final class SQLParseCountAdviceTest extends
MetricsAdviceBaseTest {
@After
public void reset() {
- ((FixtureWrapper)
MetricsWrapperRegistry.get("parsed_insert_sql_total")).reset();
- ((FixtureWrapper)
MetricsWrapperRegistry.get("parsed_update_sql_total")).reset();
- ((FixtureWrapper)
MetricsWrapperRegistry.get("parsed_delete_sql_total")).reset();
- ((FixtureWrapper)
MetricsWrapperRegistry.get("parsed_select_sql_total")).reset();
- ((FixtureWrapper)
MetricsWrapperRegistry.get("parsed_ddl_total")).reset();
- ((FixtureWrapper)
MetricsWrapperRegistry.get("parsed_dcl_total")).reset();
- ((FixtureWrapper)
MetricsWrapperRegistry.get("parsed_dal_total")).reset();
- ((FixtureWrapper)
MetricsWrapperRegistry.get("parsed_tcl_total")).reset();
- ((FixtureWrapper)
MetricsWrapperRegistry.get("parsed_rql_total")).reset();
- ((FixtureWrapper)
MetricsWrapperRegistry.get("parsed_rdl_total")).reset();
- ((FixtureWrapper)
MetricsWrapperRegistry.get("parsed_ral_total")).reset();
- ((FixtureWrapper)
MetricsWrapperRegistry.get("parsed_rul_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("parsed_insert_sql_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("parsed_update_sql_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("parsed_delete_sql_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("parsed_select_sql_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("parsed_ddl_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("parsed_dcl_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("parsed_dal_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("parsed_tcl_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("parsed_rql_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("parsed_rdl_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("parsed_ral_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("parsed_rul_total")).reset();
}
@Test
@@ -123,6 +123,6 @@ public final class SQLParseCountAdviceTest extends
MetricsAdviceBaseTest {
private void assertParse(final String metricIds, final SQLStatement
sqlStatement) {
new SQLParseCountAdvice().afterMethod(new MockTargetAdviceObject(),
mock(Method.class), new Object[]{}, sqlStatement);
- assertThat(((FixtureWrapper)
MetricsWrapperRegistry.get(metricIds)).getFixtureValue(), is(1d));
+ assertThat(((FixtureMetricsCollector)
MetricsCollectorRegistry.get(metricIds)).getFixtureValue(), is(1d));
}
}
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java
index b47c1319235..9b6b5924ab0 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java
@@ -17,8 +17,8 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.advice;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureMetricsCollector;
import org.apache.shardingsphere.infra.binder.QueryContext;
import
org.apache.shardingsphere.infra.binder.statement.CommonSQLStatementContext;
import org.apache.shardingsphere.infra.context.ConnectionContext;
@@ -42,10 +42,10 @@ public final class SQLRouteCountAdviceTest extends
MetricsAdviceBaseTest {
@After
public void reset() {
- ((FixtureWrapper)
MetricsWrapperRegistry.get("routed_insert_sql_total")).reset();
- ((FixtureWrapper)
MetricsWrapperRegistry.get("routed_update_sql_total")).reset();
- ((FixtureWrapper)
MetricsWrapperRegistry.get("routed_delete_sql_total")).reset();
- ((FixtureWrapper)
MetricsWrapperRegistry.get("routed_select_sql_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("routed_insert_sql_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("routed_update_sql_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("routed_delete_sql_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("routed_select_sql_total")).reset();
}
@Test
@@ -74,6 +74,6 @@ public final class SQLRouteCountAdviceTest extends
MetricsAdviceBaseTest {
public void assertRoute(final String metricId, final QueryContext
queryContext) {
advice.beforeMethod(new MockTargetAdviceObject(), mock(Method.class),
new Object[]{new ConnectionContext(), queryContext});
- assertThat(((FixtureWrapper)
MetricsWrapperRegistry.get(metricId)).getFixtureValue(), is(1d));
+ assertThat(((FixtureMetricsCollector)
MetricsCollectorRegistry.get(metricId)).getFixtureValue(), is(1d));
}
}
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdviceTest.java
index 68c6a8f9db4..e1f60067b13 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdviceTest.java
@@ -17,10 +17,10 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.advice.MetricsAdviceBaseTest;
import
org.apache.shardingsphere.agent.plugin.metrics.core.advice.MockTargetAdviceObject;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureMetricsCollector;
import org.junit.After;
import org.junit.Test;
@@ -38,12 +38,12 @@ public final class CommitTransactionsCountAdviceTest
extends MetricsAdviceBaseTe
@After
public void reset() {
- ((FixtureWrapper)
MetricsWrapperRegistry.get("proxy_commit_transactions_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("proxy_commit_transactions_total")).reset();
}
@Test
public void assertMethod() {
advice.beforeMethod(new MockTargetAdviceObject(), mock(Method.class),
new Object[]{});
- assertThat(((FixtureWrapper)
MetricsWrapperRegistry.get(PROXY_COMMIT_TRANSACTIONS_METRIC_KEY)).getFixtureValue(),
is(1D));
+ assertThat(((FixtureMetricsCollector)
MetricsCollectorRegistry.get(PROXY_COMMIT_TRANSACTIONS_METRIC_KEY)).getFixtureValue(),
is(1D));
}
}
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdviceTest.java
index fd9925ed109..482458655d0 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdviceTest.java
@@ -17,10 +17,10 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.advice.MetricsAdviceBaseTest;
import
org.apache.shardingsphere.agent.plugin.metrics.core.advice.MockTargetAdviceObject;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureMetricsCollector;
import org.junit.After;
import org.junit.Test;
@@ -37,7 +37,7 @@ public final class CurrentConnectionsCountAdviceTest extends
MetricsAdviceBaseTe
@After
public void reset() {
- ((FixtureWrapper)
MetricsWrapperRegistry.get("proxy_current_connections")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("proxy_current_connections")).reset();
}
@Test
@@ -46,7 +46,7 @@ public final class CurrentConnectionsCountAdviceTest extends
MetricsAdviceBaseTe
advice.beforeMethod(targetObject, mockMethod("channelActive"), new
Object[]{});
advice.beforeMethod(targetObject, mockMethod("channelActive"), new
Object[]{});
advice.beforeMethod(targetObject, mockMethod("channelInactive"), new
Object[]{});
- assertThat(((FixtureWrapper)
MetricsWrapperRegistry.get("proxy_current_connections")).getFixtureValue(),
is(1d));
+ assertThat(((FixtureMetricsCollector)
MetricsCollectorRegistry.get("proxy_current_connections")).getFixtureValue(),
is(1d));
}
private Method mockMethod(final String methodName) {
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdviceTest.java
index 988afbeedd5..2e9402f0ddf 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdviceTest.java
@@ -17,10 +17,10 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.advice.MetricsAdviceBaseTest;
import
org.apache.shardingsphere.agent.plugin.metrics.core.advice.MockTargetAdviceObject;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureMetricsCollector;
import org.junit.After;
import org.junit.Test;
@@ -34,13 +34,13 @@ public final class ExecuteErrorsCountAdviceTest extends
MetricsAdviceBaseTest {
@After
public void reset() {
- ((FixtureWrapper)
MetricsWrapperRegistry.get("proxy_execute_errors_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("proxy_execute_errors_total")).reset();
}
@Test
public void assertCountExecuteErrors() {
MockTargetAdviceObject targetObject = new MockTargetAdviceObject();
new ExecuteErrorsCountAdvice().afterMethod(targetObject,
mock(Method.class), new Object[]{}, null);
- assertThat(((FixtureWrapper)
MetricsWrapperRegistry.get("proxy_execute_errors_total")).getFixtureValue(),
is(1d));
+ assertThat(((FixtureMetricsCollector)
MetricsCollectorRegistry.get("proxy_execute_errors_total")).getFixtureValue(),
is(1d));
}
}
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdviceTest.java
index f708ea450a8..4c006a259b8 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdviceTest.java
@@ -17,10 +17,10 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.advice.MetricsAdviceBaseTest;
import
org.apache.shardingsphere.agent.plugin.metrics.core.advice.MockTargetAdviceObject;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureMetricsCollector;
import org.junit.After;
import org.junit.Test;
@@ -34,7 +34,7 @@ public final class ExecuteLatencyHistogramAdviceTest extends
MetricsAdviceBaseTe
@After
public void reset() {
- ((FixtureWrapper)
MetricsWrapperRegistry.get("proxy_execute_latency_millis")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("proxy_execute_latency_millis")).reset();
}
@Test
@@ -45,6 +45,6 @@ public final class ExecuteLatencyHistogramAdviceTest extends
MetricsAdviceBaseTe
advice.beforeMethod(targetObject, method, new Object[]{});
Thread.sleep(500L);
advice.afterMethod(targetObject, method, new Object[]{}, null);
- assertThat(((FixtureWrapper)
MetricsWrapperRegistry.get("proxy_execute_latency_millis")).getFixtureValue(),
greaterThanOrEqualTo(500D));
+ assertThat(((FixtureMetricsCollector)
MetricsCollectorRegistry.get("proxy_execute_latency_millis")).getFixtureValue(),
greaterThanOrEqualTo(500D));
}
}
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdviceTest.java
index 68aa2d8e534..c9316d13c97 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdviceTest.java
@@ -17,10 +17,10 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.advice.MetricsAdviceBaseTest;
import
org.apache.shardingsphere.agent.plugin.metrics.core.advice.MockTargetAdviceObject;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureMetricsCollector;
import org.junit.After;
import org.junit.Test;
@@ -36,13 +36,13 @@ public final class RequestsCountAdviceTest extends
MetricsAdviceBaseTest {
@After
public void reset() {
- ((FixtureWrapper)
MetricsWrapperRegistry.get("proxy_requests_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("proxy_requests_total")).reset();
}
@Test
public void assertCountRequests() {
MockTargetAdviceObject targetObject = new MockTargetAdviceObject();
advice.beforeMethod(targetObject, mock(Method.class), new Object[]{});
- assertThat(((FixtureWrapper)
MetricsWrapperRegistry.get("proxy_requests_total")).getFixtureValue(), is(1d));
+ assertThat(((FixtureMetricsCollector)
MetricsCollectorRegistry.get("proxy_requests_total")).getFixtureValue(),
is(1d));
}
}
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdviceTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdviceTest.java
index 75f734805aa..70b07d127d2 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdviceTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdviceTest.java
@@ -17,10 +17,10 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.core.advice.MetricsAdviceBaseTest;
import
org.apache.shardingsphere.agent.plugin.metrics.core.advice.MockTargetAdviceObject;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.FixtureMetricsCollector;
import org.junit.After;
import org.junit.Test;
@@ -36,12 +36,12 @@ public final class RollbackTransactionsCountAdviceTest
extends MetricsAdviceBase
@After
public void reset() {
- ((FixtureWrapper)
MetricsWrapperRegistry.get("proxy_rollback_transactions_total")).reset();
+ ((FixtureMetricsCollector)
MetricsCollectorRegistry.get("proxy_rollback_transactions_total")).reset();
}
@Test
public void assertMethod() {
advice.beforeMethod(new MockTargetAdviceObject(), mock(Method.class),
new Object[]{});
- assertThat(((FixtureWrapper)
MetricsWrapperRegistry.get("proxy_rollback_transactions_total")).getFixtureValue(),
is(1D));
+ assertThat(((FixtureMetricsCollector)
MetricsCollectorRegistry.get("proxy_rollback_transactions_total")).getFixtureValue(),
is(1D));
}
}
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/fixture/FixtureWrapperFactory.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/fixture/FixtureCollectorFactory.java
similarity index 81%
rename from
agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/fixture/FixtureWrapperFactory.java
rename to
agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/fixture/FixtureCollectorFactory.java
index 32860d7063c..1cff17ff0c7 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/fixture/FixtureWrapperFactory.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/fixture/FixtureCollectorFactory.java
@@ -17,13 +17,13 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.fixture;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperFactory;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorFactory;
-public final class FixtureWrapperFactory implements MetricsWrapperFactory {
+public final class FixtureCollectorFactory implements MetricsCollectorFactory {
@Override
- public MetricsWrapper create(final String id) {
- return new FixtureWrapper();
+ public MetricsCollector create(final String id) {
+ return new FixtureMetricsCollector();
}
}
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/fixture/FixtureWrapper.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/fixture/FixtureMetricsCollector.java
similarity index 84%
rename from
agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/fixture/FixtureWrapper.java
rename to
agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/fixture/FixtureMetricsCollector.java
index 688e72e47ab..7f9d8a52c79 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/fixture/FixtureWrapper.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/fixture/FixtureMetricsCollector.java
@@ -18,16 +18,16 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.fixture;
import lombok.Getter;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.GaugeMetricsWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.HistogramMetricsWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.SummaryMetricsWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.GaugeMetricsCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.HistogramMetricsCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.SummaryMetricsCollector;
/**
- * Fixed metric wrapper.
+ * Fixture metrics collector.
*/
@Getter
-public final class FixtureWrapper implements CounterMetricsWrapper,
GaugeMetricsWrapper, HistogramMetricsWrapper, SummaryMetricsWrapper {
+public final class FixtureMetricsCollector implements CounterMetricsCollector,
GaugeMetricsCollector, HistogramMetricsCollector, SummaryMetricsCollector {
private Double fixtureValue = 0d;
diff --git
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleService.java
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleService.java
index 7bde9a98a99..915c4b31602 100644
---
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleService.java
+++
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleService.java
@@ -23,11 +23,11 @@ import io.prometheus.client.exporter.HTTPServer;
import io.prometheus.client.hotspot.DefaultExports;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.agent.api.PluginConfiguration;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperRegistry;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorRegistry;
import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.collector.BuildInfoCollector;
import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.collector.proxy.ProxyMetaDataInfoCollector;
import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.collector.proxy.ProxyStateCollector;
-import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.PrometheusWrapperFactory;
+import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.PrometheusCollectorFactory;
import
org.apache.shardingsphere.agent.plugin.core.config.validator.PluginConfigurationValidator;
import org.apache.shardingsphere.agent.spi.PluginLifecycleService;
@@ -48,7 +48,7 @@ public final class PrometheusPluginLifecycleService
implements PluginLifecycleSe
public void start(final PluginConfiguration pluginConfig, final boolean
isEnhancedForProxy) {
PluginConfigurationValidator.validatePort(getType(), pluginConfig);
startServer(pluginConfig, isEnhancedForProxy);
- MetricsWrapperRegistry.setMetricsFactory(new
PrometheusWrapperFactory());
+ MetricsCollectorRegistry.setMetricsFactory(new
PrometheusCollectorFactory());
}
private void startServer(final PluginConfiguration pluginConfig, final
boolean isEnhancedForProxy) {
diff --git
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/BuildInfoCollector.java
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/BuildInfoCollector.java
index 427707fa979..57b69de81be 100644
---
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/BuildInfoCollector.java
+++
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/BuildInfoCollector.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.agent.plugin.metrics.prometheus.collector;
import io.prometheus.client.Collector;
import io.prometheus.client.GaugeMetricFamily;
import lombok.RequiredArgsConstructor;
-import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.PrometheusWrapperFactory;
+import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.PrometheusCollectorFactory;
import org.apache.shardingsphere.proxy.Bootstrap;
import java.util.Arrays;
@@ -35,7 +35,7 @@ public final class BuildInfoCollector extends Collector {
private static final String BUILD_INFO_METRIC_KEY = "build_info";
- private static final PrometheusWrapperFactory FACTORY = new
PrometheusWrapperFactory();
+ private static final PrometheusCollectorFactory FACTORY = new
PrometheusCollectorFactory();
private final boolean isEnhancedForProxy;
diff --git
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/proxy/ProxyMetaDataInfoCollector.java
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/proxy/ProxyMetaDataInfoCollector.java
index accce1b5df6..c831d15b919 100644
---
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/proxy/ProxyMetaDataInfoCollector.java
+++
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/proxy/ProxyMetaDataInfoCollector.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.agent.plugin.metrics.prometheus.collector.prox
import io.prometheus.client.Collector;
import io.prometheus.client.GaugeMetricFamily;
import lombok.extern.slf4j.Slf4j;
-import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.PrometheusWrapperFactory;
+import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.PrometheusCollectorFactory;
import
org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesCreator;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
@@ -48,7 +48,7 @@ public final class ProxyMetaDataInfoCollector extends
Collector {
private static final String ACTUAL_DB_COUNT = "database_count";
- private static final PrometheusWrapperFactory FACTORY = new
PrometheusWrapperFactory();
+ private static final PrometheusCollectorFactory FACTORY = new
PrometheusCollectorFactory();
@Override
public List<MetricFamilySamples> collect() {
diff --git
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/proxy/ProxyStateCollector.java
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/proxy/ProxyStateCollector.java
index 92f4eb49000..e92f21f0f53 100644
---
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/proxy/ProxyStateCollector.java
+++
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/proxy/ProxyStateCollector.java
@@ -18,7 +18,7 @@
package
org.apache.shardingsphere.agent.plugin.metrics.prometheus.collector.proxy;
import io.prometheus.client.Collector;
-import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.PrometheusWrapperFactory;
+import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.PrometheusCollectorFactory;
import org.apache.shardingsphere.infra.state.StateContext;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
@@ -33,7 +33,7 @@ public final class ProxyStateCollector extends Collector {
public static final String PROXY_STATE_METRIC_KEY = "proxy_state";
- private static final PrometheusWrapperFactory FACTORY = new
PrometheusWrapperFactory();
+ private static final PrometheusCollectorFactory FACTORY = new
PrometheusCollectorFactory();
@Override
public List<MetricFamilySamples> collect() {
diff --git
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/PrometheusWrapperFactory.java
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/PrometheusCollectorFactory.java
similarity index 84%
rename from
agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/PrometheusWrapperFactory.java
rename to
agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/PrometheusCollectorFactory.java
index 1618f9b2893..e8750579a4e 100644
---
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/PrometheusWrapperFactory.java
+++
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/PrometheusCollectorFactory.java
@@ -22,37 +22,37 @@ import io.prometheus.client.Gauge;
import io.prometheus.client.GaugeMetricFamily;
import io.prometheus.client.Histogram;
import io.prometheus.client.Summary;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsWrapperFactory;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.MetricsCollectorFactory;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricsConfiguration;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.yaml.loader.YamlMetricConfigurationsLoader;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.yaml.swapper.YamlMetricsConfigurationSwapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type.PrometheusCounterWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type.PrometheusGaugeWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type.PrometheusHistogramWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type.PrometheusSummaryWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type.PrometheusCounterCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type.PrometheusGaugeCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type.PrometheusHistogramCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type.PrometheusSummaryCollector;
import java.util.List;
import java.util.Map;
/**
- * Prometheus metrics wrapper factory.
+ * Prometheus metrics collector factory.
*/
-public final class PrometheusWrapperFactory implements MetricsWrapperFactory {
+public final class PrometheusCollectorFactory implements
MetricsCollectorFactory {
private static final MetricsConfiguration METRICS_CONFIG;
static {
- METRICS_CONFIG =
YamlMetricsConfigurationSwapper.swap(YamlMetricConfigurationsLoader.load(PrometheusWrapperFactory.class.getResourceAsStream("/META-INF/conf/prometheus-metrics.yaml")));
+ METRICS_CONFIG =
YamlMetricsConfigurationSwapper.swap(YamlMetricConfigurationsLoader.load(PrometheusCollectorFactory.class.getResourceAsStream("/META-INF/conf/prometheus-metrics.yaml")));
}
@Override
- public MetricsWrapper create(final String id) {
+ public MetricsCollector create(final String id) {
return create(getMetricConfiguration(id));
}
- private MetricsWrapper create(final MetricConfiguration metricConfig) {
+ private MetricsCollector create(final MetricConfiguration metricConfig) {
switch (metricConfig.getType().toUpperCase()) {
case "COUNTER":
return createCounter(metricConfig);
@@ -71,25 +71,25 @@ public final class PrometheusWrapperFactory implements
MetricsWrapperFactory {
return METRICS_CONFIG.get(id);
}
- private MetricsWrapper createCounter(final MetricConfiguration
metricConfig) {
+ private MetricsCollector createCounter(final MetricConfiguration
metricConfig) {
Counter.Builder builder =
Counter.build().name(metricConfig.getId()).help(metricConfig.getHelp());
List<String> labels = metricConfig.getLabels();
if (!labels.isEmpty()) {
builder.labelNames(labels.toArray(new String[0]));
}
- return new PrometheusCounterWrapper(builder.register());
+ return new PrometheusCounterCollector(builder.register());
}
- private MetricsWrapper createGauge(final MetricConfiguration metricConfig)
{
+ private MetricsCollector createGauge(final MetricConfiguration
metricConfig) {
Gauge.Builder builder =
Gauge.build().name(metricConfig.getId()).help(metricConfig.getHelp());
List<String> labels = metricConfig.getLabels();
if (!labels.isEmpty()) {
builder.labelNames(labels.toArray(new String[0]));
}
- return new PrometheusGaugeWrapper(builder.register());
+ return new PrometheusGaugeCollector(builder.register());
}
- private MetricsWrapper createHistogram(final MetricConfiguration
metricConfig) {
+ private MetricsCollector createHistogram(final MetricConfiguration
metricConfig) {
Histogram.Builder builder =
Histogram.build().name(metricConfig.getId()).help(metricConfig.getHelp());
List<String> labels = metricConfig.getLabels();
if (!labels.isEmpty()) {
@@ -99,7 +99,7 @@ public final class PrometheusWrapperFactory implements
MetricsWrapperFactory {
if (!props.isEmpty()) {
parseHistogramProperties(builder, props);
}
- return new PrometheusHistogramWrapper(builder.register());
+ return new PrometheusHistogramCollector(builder.register());
}
@SuppressWarnings("unchecked")
@@ -121,13 +121,13 @@ public final class PrometheusWrapperFactory implements
MetricsWrapperFactory {
}
}
- private MetricsWrapper createSummary(final MetricConfiguration
metricConfig) {
+ private MetricsCollector createSummary(final MetricConfiguration
metricConfig) {
Summary.Builder builder =
Summary.build().name(metricConfig.getId()).help(metricConfig.getHelp());
List<String> labels = metricConfig.getLabels();
if (!labels.isEmpty()) {
builder.labelNames(labels.toArray(new String[0]));
}
- return new PrometheusSummaryWrapper(builder.register());
+ return new PrometheusSummaryCollector(builder.register());
}
/**
diff --git
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusCounterWrapper.java
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusCounterCollector.java
similarity index 91%
rename from
agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusCounterWrapper.java
rename to
agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusCounterCollector.java
index 04e64459d50..7177b72430b 100644
---
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusCounterWrapper.java
+++
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusCounterCollector.java
@@ -19,13 +19,13 @@ package
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type;
import io.prometheus.client.Counter;
import lombok.RequiredArgsConstructor;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.CounterMetricsCollector;
/**
* Prometheus counter wrapper.
*/
@RequiredArgsConstructor
-public final class PrometheusCounterWrapper implements CounterMetricsWrapper {
+public final class PrometheusCounterCollector implements
CounterMetricsCollector {
private final Counter counter;
diff --git
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusGaugeWrapper.java
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusGaugeCollector.java
similarity index 93%
rename from
agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusGaugeWrapper.java
rename to
agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusGaugeCollector.java
index 830d51cb3c8..6d753de1c38 100644
---
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusGaugeWrapper.java
+++
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusGaugeCollector.java
@@ -19,13 +19,13 @@ package
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type;
import io.prometheus.client.Gauge;
import lombok.RequiredArgsConstructor;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.GaugeMetricsWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.GaugeMetricsCollector;
/**
* Prometheus gauge wrapper.
*/
@RequiredArgsConstructor
-public final class PrometheusGaugeWrapper implements GaugeMetricsWrapper {
+public final class PrometheusGaugeCollector implements GaugeMetricsCollector {
private final Gauge gauge;
diff --git
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusHistogramWrapper.java
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusHistogramCollector.java
similarity index 91%
rename from
agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusHistogramWrapper.java
rename to
agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusHistogramCollector.java
index 73990c53494..f6133a4f8f6 100644
---
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusHistogramWrapper.java
+++
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusHistogramCollector.java
@@ -19,13 +19,13 @@ package
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type;
import io.prometheus.client.Histogram;
import lombok.RequiredArgsConstructor;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.HistogramMetricsWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.HistogramMetricsCollector;
/**
* Prometheus histogram wrapper.
*/
@RequiredArgsConstructor
-public final class PrometheusHistogramWrapper implements
HistogramMetricsWrapper {
+public final class PrometheusHistogramCollector implements
HistogramMetricsCollector {
private final Histogram histogram;
diff --git
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusSummaryWrapper.java
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusSummaryCollector.java
similarity index 91%
rename from
agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusSummaryWrapper.java
rename to
agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusSummaryCollector.java
index ddb18cad8ff..09aac8c7899 100644
---
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusSummaryWrapper.java
+++
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusSummaryCollector.java
@@ -19,13 +19,13 @@ package
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type;
import io.prometheus.client.Summary;
import lombok.RequiredArgsConstructor;
-import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.SummaryMetricsWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.core.wrapper.type.SummaryMetricsCollector;
/**
* Prometheus summary wrapper.
*/
@RequiredArgsConstructor
-public final class PrometheusSummaryWrapper implements SummaryMetricsWrapper {
+public final class PrometheusSummaryCollector implements
SummaryMetricsCollector {
private final Summary summary;
diff --git
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/PrometheusWrapperFactoryTest.java
b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/PrometheusWrapperFactoryTest.java
index 118260288db..8f0fe2f9596 100644
---
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/PrometheusWrapperFactoryTest.java
+++
b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/PrometheusWrapperFactoryTest.java
@@ -17,10 +17,10 @@
package org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type.PrometheusCounterWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type.PrometheusGaugeWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type.PrometheusHistogramWrapper;
-import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type.PrometheusSummaryWrapper;
+import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type.PrometheusCounterCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type.PrometheusGaugeCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type.PrometheusHistogramCollector;
+import
org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.type.PrometheusSummaryCollector;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.instanceOf;
@@ -30,11 +30,11 @@ public final class PrometheusWrapperFactoryTest {
@Test
public void assertCreate() {
- PrometheusWrapperFactory factory = new PrometheusWrapperFactory();
- assertThat(factory.create("a"),
instanceOf(PrometheusCounterWrapper.class));
- assertThat(factory.create("b"),
instanceOf(PrometheusGaugeWrapper.class));
- assertThat(factory.create("c"),
instanceOf(PrometheusHistogramWrapper.class));
- assertThat(factory.create("d"),
instanceOf(PrometheusHistogramWrapper.class));
- assertThat(factory.create("e"),
instanceOf(PrometheusSummaryWrapper.class));
+ PrometheusCollectorFactory factory = new PrometheusCollectorFactory();
+ assertThat(factory.create("a"),
instanceOf(PrometheusCounterCollector.class));
+ assertThat(factory.create("b"),
instanceOf(PrometheusGaugeCollector.class));
+ assertThat(factory.create("c"),
instanceOf(PrometheusHistogramCollector.class));
+ assertThat(factory.create("d"),
instanceOf(PrometheusHistogramCollector.class));
+ assertThat(factory.create("e"),
instanceOf(PrometheusSummaryCollector.class));
}
}
diff --git
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusCounterWrapperTest.java
b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusCounterWrapperTest.java
index 6e59186b0e3..4cd617a420f 100644
---
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusCounterWrapperTest.java
+++
b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusCounterWrapperTest.java
@@ -29,9 +29,9 @@ public final class PrometheusCounterWrapperTest {
@Test
public void assertCreate() throws ReflectiveOperationException {
Counter counter = Counter.build().name("a").help("help").create();
- PrometheusCounterWrapper counterWrapper = new
PrometheusCounterWrapper(counter);
+ PrometheusCounterCollector counterWrapper = new
PrometheusCounterCollector(counter);
counterWrapper.inc();
- counter = (Counter)
Plugins.getMemberAccessor().get(PrometheusCounterWrapper.class.getDeclaredField("counter"),
counterWrapper);
+ counter = (Counter)
Plugins.getMemberAccessor().get(PrometheusCounterCollector.class.getDeclaredField("counter"),
counterWrapper);
assertThat(counter.get(), is(1d));
}
}
diff --git
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusGaugeWrapperTest.java
b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusGaugeWrapperTest.java
index 44ada954f67..fe948a1f314 100644
---
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusGaugeWrapperTest.java
+++
b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusGaugeWrapperTest.java
@@ -29,9 +29,9 @@ public final class PrometheusGaugeWrapperTest {
@Test
public void assertCreate() throws ReflectiveOperationException {
Gauge gauge = Gauge.build().name("a").help("help").create();
- PrometheusGaugeWrapper gaugeWrapper = new
PrometheusGaugeWrapper(gauge);
+ PrometheusGaugeCollector gaugeWrapper = new
PrometheusGaugeCollector(gauge);
gaugeWrapper.inc();
- gauge = (Gauge)
Plugins.getMemberAccessor().get(PrometheusGaugeWrapper.class.getDeclaredField("gauge"),
gaugeWrapper);
+ gauge = (Gauge)
Plugins.getMemberAccessor().get(PrometheusGaugeCollector.class.getDeclaredField("gauge"),
gaugeWrapper);
assertThat(gauge.get(), is(1d));
}
}
diff --git
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusHistogramWrapperTest.java
b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusHistogramWrapperTest.java
index 64e865d98c7..e1aea449052 100644
---
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusHistogramWrapperTest.java
+++
b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusHistogramWrapperTest.java
@@ -29,9 +29,9 @@ public final class PrometheusHistogramWrapperTest {
@Test
public void assertCreate() throws ReflectiveOperationException {
Histogram histogram =
Histogram.build().name("a").help("help").create();
- PrometheusHistogramWrapper histogramWrapper = new
PrometheusHistogramWrapper(histogram);
+ PrometheusHistogramCollector histogramWrapper = new
PrometheusHistogramCollector(histogram);
histogramWrapper.observe(1);
- histogram = (Histogram)
Plugins.getMemberAccessor().get(PrometheusHistogramWrapper.class.getDeclaredField("histogram"),
histogramWrapper);
+ histogram = (Histogram)
Plugins.getMemberAccessor().get(PrometheusHistogramCollector.class.getDeclaredField("histogram"),
histogramWrapper);
assertThat(histogram.collect().size(), is(1));
}
}
diff --git
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusSummaryWrapperTest.java
b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusSummaryWrapperTest.java
index b0d514aeb41..5e8a31a906e 100644
---
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusSummaryWrapperTest.java
+++
b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/wrapper/type/PrometheusSummaryWrapperTest.java
@@ -28,9 +28,9 @@ public final class PrometheusSummaryWrapperTest {
@Test
public void assertCreate() throws ReflectiveOperationException {
- PrometheusSummaryWrapper summaryWrapper = new
PrometheusSummaryWrapper(Summary.build().name("a").help("help").create());
+ PrometheusSummaryCollector summaryWrapper = new
PrometheusSummaryCollector(Summary.build().name("a").help("help").create());
summaryWrapper.observe(1);
- Summary summary = (Summary)
Plugins.getMemberAccessor().get(PrometheusSummaryWrapper.class.getDeclaredField("summary"),
summaryWrapper);
+ Summary summary = (Summary)
Plugins.getMemberAccessor().get(PrometheusSummaryCollector.class.getDeclaredField("summary"),
summaryWrapper);
assertThat(summary.collect().size(), is(1));
}
}