This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang 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 78fd8cc7280 Remove useless exporter (#23655)
78fd8cc7280 is described below

commit 78fd8cc7280c552dc7a9d74d992d1054db185d8c
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Jan 19 19:02:30 2023 +0800

    Remove useless exporter (#23655)
---
 .../exoprter/PrometheusJDKBuildInfoExporter.java   | 39 -----------------
 .../proxy/PrometheusProxyMetaDataInfoExporter.java | 39 -----------------
 .../proxy/PrometheusProxyStateExporter.java        | 39 -----------------
 .../PrometheusJDKBuildInfoExporterTest.java        | 30 -------------
 .../PrometheusProxyMetaDataInfoExporterTest.java   | 36 ----------------
 .../proxy/PrometheusProxyStateExporterTest.java    | 50 ----------------------
 6 files changed, 233 deletions(-)

diff --git 
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/PrometheusJDKBuildInfoExporter.java
 
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/PrometheusJDKBuildInfoExporter.java
deleted file mode 100644
index 8ff0d4756a4..00000000000
--- 
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/PrometheusJDKBuildInfoExporter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.agent.plugin.metrics.prometheus.exoprter;
-
-import io.prometheus.client.Collector;
-import io.prometheus.client.GaugeMetricFamily;
-import 
org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.GaugeMetricFamilyMetricsCollector;
-import 
org.apache.shardingsphere.agent.plugin.metrics.core.exporter.impl.JDKBuildInfoExporter;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Optional;
-
-/**
- * Prometheus JDK build information exporter.
- */
-public final class PrometheusJDKBuildInfoExporter extends Collector {
-    
-    @Override
-    public List<MetricFamilySamples> collect() {
-        Optional<GaugeMetricFamilyMetricsCollector> collector = new 
JDKBuildInfoExporter().export("Prometheus");
-        return collector.<List<MetricFamilySamples>>map(optional -> 
Collections.singletonList((GaugeMetricFamily) 
optional.getRawMetricFamilyObject())).orElse(Collections.emptyList());
-    }
-}
diff --git 
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/proxy/PrometheusProxyMetaDataInfoExporter.java
 
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/proxy/PrometheusProxyMetaDataInfoExporter.java
deleted file mode 100644
index ec06d0a12ba..00000000000
--- 
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/proxy/PrometheusProxyMetaDataInfoExporter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package 
org.apache.shardingsphere.agent.plugin.metrics.prometheus.exoprter.proxy;
-
-import io.prometheus.client.Collector;
-import io.prometheus.client.GaugeMetricFamily;
-import 
org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.GaugeMetricFamilyMetricsCollector;
-import 
org.apache.shardingsphere.agent.plugin.metrics.core.exporter.impl.proxy.ProxyMetaDataInfoExporter;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Optional;
-
-/**
- * Prometheus proxy meta data information exporter.
- */
-public final class PrometheusProxyMetaDataInfoExporter extends Collector {
-    
-    @Override
-    public List<MetricFamilySamples> collect() {
-        Optional<GaugeMetricFamilyMetricsCollector> collector = new 
ProxyMetaDataInfoExporter().export("Prometheus");
-        return collector.<List<MetricFamilySamples>>map(optional -> 
Collections.singletonList((GaugeMetricFamily) 
optional.getRawMetricFamilyObject())).orElse(Collections.emptyList());
-    }
-}
diff --git 
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/proxy/PrometheusProxyStateExporter.java
 
b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/proxy/PrometheusProxyStateExporter.java
deleted file mode 100644
index 90563785668..00000000000
--- 
a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/proxy/PrometheusProxyStateExporter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package 
org.apache.shardingsphere.agent.plugin.metrics.prometheus.exoprter.proxy;
-
-import io.prometheus.client.Collector;
-import io.prometheus.client.GaugeMetricFamily;
-import 
org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.GaugeMetricFamilyMetricsCollector;
-import 
org.apache.shardingsphere.agent.plugin.metrics.core.exporter.impl.proxy.ProxyStateExporter;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Optional;
-
-/**
- * Prometheus proxy state exporter.
- */
-public final class PrometheusProxyStateExporter extends Collector {
-    
-    @Override
-    public List<MetricFamilySamples> collect() {
-        Optional<GaugeMetricFamilyMetricsCollector> collector = new 
ProxyStateExporter().export("Prometheus");
-        return collector.<List<MetricFamilySamples>>map(optional -> 
Collections.singletonList((GaugeMetricFamily) 
optional.getRawMetricFamilyObject())).orElse(Collections.emptyList());
-    }
-}
diff --git 
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/PrometheusJDKBuildInfoExporterTest.java
 
b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/PrometheusJDKBuildInfoExporterTest.java
deleted file mode 100644
index 14828250961..00000000000
--- 
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/PrometheusJDKBuildInfoExporterTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.agent.plugin.metrics.prometheus.exoprter;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertFalse;
-
-public final class PrometheusJDKBuildInfoExporterTest {
-    
-    @Test
-    public void assertCollect() {
-        assertFalse(new PrometheusJDKBuildInfoExporter().collect().isEmpty());
-    }
-}
diff --git 
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/proxy/PrometheusProxyMetaDataInfoExporterTest.java
 
b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/proxy/PrometheusProxyMetaDataInfoExporterTest.java
deleted file mode 100644
index 0f781931e06..00000000000
--- 
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/proxy/PrometheusProxyMetaDataInfoExporterTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package 
org.apache.shardingsphere.agent.plugin.metrics.prometheus.exoprter.proxy;
-
-import 
org.apache.shardingsphere.agent.plugin.metrics.prometheus.ProxyContextRestorer;
-import org.apache.shardingsphere.mode.manager.ContextManager;
-import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.junit.Test;
-
-import static org.junit.Assert.assertFalse;
-import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.mock;
-
-public final class PrometheusProxyMetaDataInfoExporterTest extends 
ProxyContextRestorer {
-    
-    @Test
-    public void assertCollect() {
-        ProxyContext.init(mock(ContextManager.class, RETURNS_DEEP_STUBS));
-        assertFalse(new 
PrometheusProxyMetaDataInfoExporter().collect().isEmpty());
-    }
-}
diff --git 
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/proxy/PrometheusProxyStateExporterTest.java
 
b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/proxy/PrometheusProxyStateExporterTest.java
deleted file mode 100644
index 1eeb9b85ae5..00000000000
--- 
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/proxy/PrometheusProxyStateExporterTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package 
org.apache.shardingsphere.agent.plugin.metrics.prometheus.exoprter.proxy;
-
-import 
org.apache.shardingsphere.agent.plugin.metrics.prometheus.ProxyContextRestorer;
-import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
-import org.apache.shardingsphere.infra.instance.ComputeNodeInstance;
-import org.apache.shardingsphere.infra.instance.InstanceContext;
-import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
-import org.apache.shardingsphere.infra.instance.mode.ModeContextManager;
-import org.apache.shardingsphere.infra.lock.LockContext;
-import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
-import org.apache.shardingsphere.infra.util.eventbus.EventBusContext;
-import org.apache.shardingsphere.mode.manager.ContextManager;
-import 
org.apache.shardingsphere.mode.manager.standalone.workerid.generator.StandaloneWorkerIdGenerator;
-import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
-import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
-import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.junit.Test;
-
-import static org.junit.Assert.assertFalse;
-import static org.mockito.Mockito.mock;
-
-public final class PrometheusProxyStateExporterTest extends 
ProxyContextRestorer {
-    
-    @Test
-    public void assertCollect() {
-        MetaDataContexts metaDataContexts = new 
MetaDataContexts(mock(MetaDataPersistService.class), new 
ShardingSphereMetaData());
-        InstanceContext instanceContext = new InstanceContext(
-                new ComputeNodeInstance(mock(InstanceMetaData.class)), new 
StandaloneWorkerIdGenerator(), new ModeConfiguration("Standalone", null),
-                mock(ModeContextManager.class), mock(LockContext.class), new 
EventBusContext());
-        ProxyContext.init(new ContextManager(metaDataContexts, 
instanceContext));
-        assertFalse(new PrometheusProxyStateExporter().collect().isEmpty());
-    }
-}

Reply via email to