This is an automated email from the ASF dual-hosted git repository. udo pushed a commit to branch feature/Micrometer in repository https://gitbox.apache.org/repos/asf/geode.git
commit 1b2e036e96f63a4f0518f9c60dac5994c22ed969 Author: Udo Kohlmeyer <[email protected]> AuthorDate: Sun Sep 23 15:30:22 2018 -0700 Some changes --- geode-assembly/build.gradle | 9 +- geode-core/build.gradle | 2 +- .../statistics/InternalDistributedSystemStats.java | 7 +- .../internal/beans/stats/MBeanStatsMonitor.java | 191 +++++++++++---------- geode-core/src/main/kotlin/Server.kt | 59 ------- .../AsyncEventQueueProcessor.kt} | 30 ++-- geode-core/src/main/kotlin/{ => demo}/Client.kt | 7 +- geode-core/src/main/kotlin/{ => demo}/Locator.kt | 14 +- .../src/main/kotlin/{Locator.kt => demo/Server.kt} | 33 ++-- geode-core/src/main/resources/cache123.xml | 44 +++++ .../cache/query/internal/cq/CqServiceImpl.java | 2 +- .../statistics/cache/MicrometerCachePerfStats.kt | 4 +- .../micrometer/impl/MicrometerStatisticsManager.kt | 18 +- .../micrometer/MicrometerStatisticsFactoryImpl.kt | 3 +- .../statistics/wan/MicrometerGatewaySenderStats.kt | 9 +- .../common/statistics/factory/StatsFactory.java | 14 +- 16 files changed, 225 insertions(+), 221 deletions(-) diff --git a/geode-assembly/build.gradle b/geode-assembly/build.gradle index 075467b..7df962e 100755 --- a/geode-assembly/build.gradle +++ b/geode-assembly/build.gradle @@ -251,7 +251,14 @@ def cp = { it.contains('lucene-queryparser') || it.contains('lucene-analyzers-phonetic') || - it.contains('micrometer-stats') || + it.contains('micrometer') || + it.contains('guava') || + it.contains('kotlin') || + it.contains('reflections') || + it.contains('javassist') || + it.contains('commons-modeler') || + it.contains('mx4j') || + it.contains('Latency') || // dependencies from geode-protobuf it.contains('protobuf-java') || diff --git a/geode-core/build.gradle b/geode-core/build.gradle index f41a13d..b36493c 100755 --- a/geode-core/build.gradle +++ b/geode-core/build.gradle @@ -43,7 +43,7 @@ compileKotlin { kotlinOptions.jvmTarget = sourceCompatibility } compileTestKotlin { kotlinOptions.jvmTarget = sourceCompatibility } buildscript { - ext.kotlin_version = '1.2.61' + ext.kotlin_version = '1.2.70' repositories { mavenCentral() diff --git a/geode-core/src/main/java/org/apache/geode/internal/statistics/InternalDistributedSystemStats.java b/geode-core/src/main/java/org/apache/geode/internal/statistics/InternalDistributedSystemStats.java index 2108590..b28ffab 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/statistics/InternalDistributedSystemStats.java +++ b/geode-core/src/main/java/org/apache/geode/internal/statistics/InternalDistributedSystemStats.java @@ -42,7 +42,8 @@ public class InternalDistributedSystemStats { * The sampler for this DistributedSystem. */ private GemFireStatSampler sampler = null; - private FunctionServiceStats functionServiceStats; + private FunctionServiceStats functionServiceStats = + StatsFactory.createStatsImpl(FunctionServiceStats.class, "FunctionExecution"); private boolean statsDisabled; private StatisticsFactory statisticsFactory = StatsFactory.getStatisticsFactory(); @@ -50,10 +51,7 @@ public class InternalDistributedSystemStats { private InternalDistributedSystemStats() {} public static InternalDistributedSystemStats createInstance(boolean statsDisabled) { - singleton.statsDisabled = statsDisabled; - singleton.functionServiceStats = - StatsFactory.createStatsImpl(FunctionServiceStats.class, "FunctionExecution"); return singleton; } @@ -85,6 +83,7 @@ public class InternalDistributedSystemStats { FunctionStats stats = functionExecutionStatsMap.get(textId); if (stats == null) { stats = StatsFactory.createStatsImpl(FunctionStats.class, textId); + System.out.println("stats = " + stats+ " textId = "+textId); FunctionStats oldStats = functionExecutionStatsMap.putIfAbsent(textId, stats); if (oldStats != null) { stats.close(); diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/stats/MBeanStatsMonitor.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/stats/MBeanStatsMonitor.java index 6bd03c0..d682ea4 100644 --- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/stats/MBeanStatsMonitor.java +++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/stats/MBeanStatsMonitor.java @@ -12,13 +12,12 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ + package org.apache.geode.management.internal.beans.stats; import java.util.HashMap; import java.util.Map; -import org.apache.logging.log4j.Logger; - import org.apache.geode.internal.logging.LogService; import org.apache.geode.internal.statistics.StatisticId; import org.apache.geode.internal.statistics.StatisticNotFoundException; @@ -28,102 +27,108 @@ import org.apache.geode.internal.statistics.ValueMonitor; import org.apache.geode.stats.common.statistics.StatisticDescriptor; import org.apache.geode.stats.common.statistics.Statistics; import org.apache.geode.stats.common.statistics.StatisticsType; +import org.apache.logging.log4j.Logger; /** * Class to get mappings of stats name to their values */ public class MBeanStatsMonitor implements StatisticsListener { - private static final Logger logger = LogService.getLogger(); - - protected ValueMonitor monitor; - - /** - * Map which contains statistics with their name and value - */ - protected DefaultHashMap statsMap; - - protected String monitorName; - - public MBeanStatsMonitor(final String name) { - this(name, new ValueMonitor()); - } - - MBeanStatsMonitor(final String name, final ValueMonitor monitor) { - this.monitorName = name; - this.monitor = monitor; - this.statsMap = new DefaultHashMap(); - } - - public void addStatisticsToMonitor(final Statistics stats) { - monitor.addListener(this);// if already listener is added this will be a no-op - // Initialize the stats with the current values. - StatisticsType type = stats.getType(); - StatisticDescriptor[] descriptors = type.getStatistics(); - for (StatisticDescriptor d : descriptors) { - statsMap.put(d.getName(), stats.get(d)); - } - monitor.addStatistics(stats); - } - - public void removeStatisticsFromMonitor(final Statistics stats) { - statsMap.clear(); - } - - public void stopListener() { - monitor.removeListener(this); - } - - public Number getStatistic(final String statName) { - Number value = statsMap.get(statName); - return value != null ? value : 0; - } - - @Override - public void handleNotification(final StatisticsNotification notification) { - for (StatisticId statId : notification) { - StatisticDescriptor descriptor = statId.getStatisticDescriptor(); - String name = descriptor.getName(); - Number value; - try { - value = notification.getValue(statId); - } catch (StatisticNotFoundException e) { - value = 0; - } - log(name, value); - statsMap.put(name, value); - } - } - - protected void log(final String name, final Number value) { - if (logger.isTraceEnabled()) { - logger.trace("Monitor = {} descriptor = {} And value = {}", monitorName, name, value); - } - } - - public static class DefaultHashMap { // TODO: delete this class - private Map<String, Number> internalMap = new HashMap<>(); - - public DefaultHashMap() {} - - public Number get(final String key) { - return internalMap.get(key) != null ? internalMap.get(key) : 0; - } - - public void put(final String key, final Number value) { - internalMap.put(key, value); - } - - public void clear() { - internalMap.clear(); - } - - /** - * For testing only - */ - Map<String, Number> getInternalMap() { - return this.internalMap; - } - } + private static final Logger logger = LogService.getLogger(); + + protected ValueMonitor monitor; + + /** + * Map which contains statistics with their name and value + */ + protected DefaultHashMap statsMap; + + protected String monitorName; + + public MBeanStatsMonitor(final String name) { + this(name, new ValueMonitor()); + } + + MBeanStatsMonitor(final String name, final ValueMonitor monitor) { + this.monitorName = name; + this.monitor = monitor; + this.statsMap = new DefaultHashMap(); + } + + public void addStatisticsToMonitor(final Statistics stats) { + monitor.addListener(this);// if already listener is added this will be a no-op + // Initialize the stats with the current values. + if (stats != null) { + StatisticsType type = stats.getType(); + StatisticDescriptor[] descriptors = type.getStatistics(); + for (StatisticDescriptor d : descriptors) { + statsMap.put(d.getName(), stats.get(d)); + } + monitor.addStatistics(stats); + } + } + + public void removeStatisticsFromMonitor(final Statistics stats) { + statsMap.clear(); + } + + public void stopListener() { + monitor.removeListener(this); + } + + public Number getStatistic(final String statName) { + Number value = statsMap.get(statName); + return value != null ? value : 0; + } + + @Override + public void handleNotification(final StatisticsNotification notification) { + for (StatisticId statId : notification) { + StatisticDescriptor descriptor = statId.getStatisticDescriptor(); + String name = descriptor.getName(); + Number value; + try { + value = notification.getValue(statId); + } + catch (StatisticNotFoundException e) { + value = 0; + } + log(name, value); + statsMap.put(name, value); + } + } + + protected void log(final String name, final Number value) { + if (logger.isTraceEnabled()) { + logger.trace("Monitor = {} descriptor = {} And value = {}", monitorName, name, value); + } + } + + public static class DefaultHashMap { // TODO: delete this class + + private Map<String, Number> internalMap = new HashMap<>(); + + public DefaultHashMap() { + } + + public Number get(final String key) { + return internalMap.get(key) != null ? internalMap.get(key) : 0; + } + + public void put(final String key, final Number value) { + internalMap.put(key, value); + } + + public void clear() { + internalMap.clear(); + } + + /** + * For testing only + */ + Map<String, Number> getInternalMap() { + return this.internalMap; + } + } } diff --git a/geode-core/src/main/kotlin/Server.kt b/geode-core/src/main/kotlin/Server.kt deleted file mode 100644 index bfdcd98..0000000 --- a/geode-core/src/main/kotlin/Server.kt +++ /dev/null @@ -1,59 +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. - */ -import org.apache.geode.cache.CacheFactory -import org.apache.geode.cache.RegionShortcut -import org.apache.geode.distributed.ConfigurationProperties -import java.io.File -import java.util.* - -fun main(args: Array<String>) { - val properties = Properties().apply { - setProperty("locators", "localhost[44550]") - setProperty("mcast-port", "0") - setProperty("statistic-sampling-enabled", "true") - setProperty(ConfigurationProperties.JMX_MANAGER, "false") - setProperty(ConfigurationProperties.JMX_MANAGER_START, "false") - setProperty(ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION, "false") - } - val cache = CacheFactory(properties).create() - cache.addCacheServer().apply { - port = 0 - bindAddress = "localhost" - }.start() - - - val diskStoreFactory = cache.createDiskStoreFactory() - val diskStore1Name = "${System.identityHashCode(cache)}_someDiskStore" - diskStoreFactory.setDiskDirs(arrayOf(File("/tmp/$diskStore1Name"))) - diskStoreFactory.create(diskStore1Name) - - val regionFactory = cache.createRegionFactory<String, String>(RegionShortcut.PARTITION_REDUNDANT_OVERFLOW) - regionFactory.setStatisticsEnabled(true) - regionFactory.setDiskStoreName(diskStore1Name) - val region1 = regionFactory.create("Region1") - - val diskStoreFactory2 = cache.createDiskStoreFactory() - val diskStore2Name = "${System.identityHashCode(cache)}_someDiskStore2" - diskStoreFactory2.setDiskDirs(arrayOf(File("/tmp/$diskStore2Name"))) - diskStoreFactory2.create(diskStore2Name) - - val regionFactory2 = cache.createRegionFactory<String, String>(RegionShortcut.PARTITION_REDUNDANT_OVERFLOW) - regionFactory2.setStatisticsEnabled(true) - regionFactory2.setDiskStoreName(diskStore2Name) - val region2 = regionFactory2.create("Region3") - - val manager = cache.resourceManager - val op = manager.createRebalanceFactory().start() -} \ No newline at end of file diff --git a/geode-core/src/main/kotlin/Locator.kt b/geode-core/src/main/kotlin/demo/AsyncEventQueueProcessor.kt similarity index 52% copy from geode-core/src/main/kotlin/Locator.kt copy to geode-core/src/main/kotlin/demo/AsyncEventQueueProcessor.kt index ca133f7..945a3e0 100644 --- a/geode-core/src/main/kotlin/Locator.kt +++ b/geode-core/src/main/kotlin/demo/AsyncEventQueueProcessor.kt @@ -1,7 +1,7 @@ /* * 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 + * 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 * @@ -12,23 +12,19 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -import org.apache.geode.distributed.ConfigurationProperties -import org.apache.geode.distributed.LocatorLauncher +package demo -fun main(args: Array<String>) { - val build = LocatorLauncher.Builder().apply { - port = 44550 - set("statistic-sampling-enabled", "true") - set(ConfigurationProperties.ENABLE_TIME_STATISTICS, "true") - set(ConfigurationProperties.JMX_MANAGER, "false") - set(ConfigurationProperties.JMX_MANAGER_START, "false") - set(ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION, "false") - }.build() +import org.apache.geode.cache.Declarable +import org.apache.geode.cache.asyncqueue.AsyncEvent +import org.apache.geode.cache.asyncqueue.AsyncEventListener +import java.util.* - build.start() - - while(true) - { - Thread.sleep(5000) +class AsyncEventQueueProcessor : AsyncEventListener, Declarable { + override fun processEvents(events: MutableList<AsyncEvent<Any, Any>>): Boolean { + val random = Random(System.currentTimeMillis()) + events.forEach { _ -> + Thread.sleep(random.nextInt(300).toLong()) + } + return true } } \ No newline at end of file diff --git a/geode-core/src/main/kotlin/Client.kt b/geode-core/src/main/kotlin/demo/Client.kt similarity index 87% rename from geode-core/src/main/kotlin/Client.kt rename to geode-core/src/main/kotlin/demo/Client.kt index cc728fc..c1e1292 100644 --- a/geode-core/src/main/kotlin/Client.kt +++ b/geode-core/src/main/kotlin/demo/Client.kt @@ -1,4 +1,4 @@ -/* +package demo/* * 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 @@ -23,7 +23,8 @@ fun main(args: Array<String>) { setProperty("mcast-port", "0") setProperty("statistic-sampling-enabled", "true") } - val cache = ClientCacheFactory(properties).addPoolLocator("localhost", 44550).create() + val cache = ClientCacheFactory(properties).addPoolLocator("35.188.91.8 ", 10334).addPoolLocator("35.202.171.126", 10334).create() +// val cache = ClientCacheFactory(properties).addPoolLocator(args[0], args[1].toInt()).addPoolLocator(args[2], args[3].toInt()).create() val regionFactory = cache.createClientRegionFactory<String, String>(ClientRegionShortcut.PROXY) regionFactory.setStatisticsEnabled(true) @@ -53,7 +54,7 @@ fun main(args: Array<String>) { region1.destroy((value*count).toString()) } } -// Thread.sleep(100) + Thread.sleep(100) println("Processed value $count") diff --git a/geode-core/src/main/kotlin/Locator.kt b/geode-core/src/main/kotlin/demo/Locator.kt similarity index 75% copy from geode-core/src/main/kotlin/Locator.kt copy to geode-core/src/main/kotlin/demo/Locator.kt index ca133f7..fd9d37d 100644 --- a/geode-core/src/main/kotlin/Locator.kt +++ b/geode-core/src/main/kotlin/demo/Locator.kt @@ -1,4 +1,4 @@ -/* +package demo/* * 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 @@ -17,18 +17,22 @@ import org.apache.geode.distributed.LocatorLauncher fun main(args: Array<String>) { val build = LocatorLauncher.Builder().apply { - port = 44550 - set("statistic-sampling-enabled", "true") + port = args[0].toInt() + set(ConfigurationProperties.NAME, args[1]) + set(ConfigurationProperties.STATISTIC_SAMPLING_ENABLED, "true") set(ConfigurationProperties.ENABLE_TIME_STATISTICS, "true") set(ConfigurationProperties.JMX_MANAGER, "false") set(ConfigurationProperties.JMX_MANAGER_START, "false") set(ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION, "false") + hostnameForClients = args[2] + set(ConfigurationProperties.BIND_ADDRESS, args[3]) + set(ConfigurationProperties.LOCATORS, args[4]) + set(ConfigurationProperties.ENABLE_NETWORK_PARTITION_DETECTION, "false") }.build() build.start() - while(true) - { + while (true) { Thread.sleep(5000) } } \ No newline at end of file diff --git a/geode-core/src/main/kotlin/Locator.kt b/geode-core/src/main/kotlin/demo/Server.kt similarity index 55% rename from geode-core/src/main/kotlin/Locator.kt rename to geode-core/src/main/kotlin/demo/Server.kt index ca133f7..1cbb40f 100644 --- a/geode-core/src/main/kotlin/Locator.kt +++ b/geode-core/src/main/kotlin/demo/Server.kt @@ -12,23 +12,32 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ +package demo + +import org.apache.geode.cache.CacheFactory import org.apache.geode.distributed.ConfigurationProperties -import org.apache.geode.distributed.LocatorLauncher +import java.util.* fun main(args: Array<String>) { - val build = LocatorLauncher.Builder().apply { - port = 44550 - set("statistic-sampling-enabled", "true") - set(ConfigurationProperties.ENABLE_TIME_STATISTICS, "true") + + val properties = Properties().apply { + set(ConfigurationProperties.LOCATORS, args[0]) + set(ConfigurationProperties.NAME, args[1]) + set(ConfigurationProperties.CACHE_XML_FILE, args[4]) + set(ConfigurationProperties.BIND_ADDRESS, args[3]) + set(ConfigurationProperties.MCAST_PORT, "0") + set(ConfigurationProperties.STATISTIC_SAMPLING_ENABLED, "true") set(ConfigurationProperties.JMX_MANAGER, "false") set(ConfigurationProperties.JMX_MANAGER_START, "false") set(ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION, "false") - }.build() - - build.start() - - while(true) - { - Thread.sleep(5000) + set(ConfigurationProperties.USE_CLUSTER_CONFIGURATION, "false") + set(ConfigurationProperties.CONSERVE_SOCKETS, "false") + set(ConfigurationProperties.ENABLE_NETWORK_PARTITION_DETECTION, "false") } + val cache = CacheFactory(properties).create() + cache.addCacheServer().apply { + port = 0 + bindAddress = args[3] + hostnameForClients = args[2] + }.start() } \ No newline at end of file diff --git a/geode-core/src/main/resources/cache123.xml b/geode-core/src/main/resources/cache123.xml new file mode 100644 index 0000000..4bd9457 --- /dev/null +++ b/geode-core/src/main/resources/cache123.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<cache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://geode.apache.org/schema/cache" + xsi:schemaLocation="http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd" + version="1.0" lock-lease="120" lock-timeout="60" search-timeout="300" is-server="true" copy-on-read="false"> + + <async-event-queue id="asyncQueue1"> + <async-event-listener> + <class-name>demo.AsyncEventQueueProcessor</class-name> + </async-event-listener> + </async-event-queue> + + <disk-store name="diskStore1" auto-compact="true" disk-usage-critical-percentage="90" max-oplog-size="1024"> + <disk-dirs> + <disk-dir>/tmp/diskstore1</disk-dir> + </disk-dirs> + </disk-store> + + <disk-store name="diskStore2" auto-compact="true" disk-usage-critical-percentage="90" max-oplog-size="1024"> + <disk-dirs> + <disk-dir>/tmp/diskstore2</disk-dir> + </disk-dirs> + </disk-store> + + <region name="Region1"> + <region-attributes async-event-queue-ids="asyncQueue1" disk-store-name="diskStore1" + data-policy="partition" statistics-enabled="true"> + <partition-attributes redundant-copies="1" total-num-buckets="113"/> + <eviction-attributes> + <lru-entry-count action="overflow-to-disk" maximum="55000"/> + </eviction-attributes> + </region-attributes> + </region> + + <region name="Region3"> + <region-attributes disk-store-name="diskStore2" + data-policy="partition" statistics-enabled="true"> + <partition-attributes startup-recovery-delay="10000" redundant-copies="1" total-num-buckets="113"/> + <eviction-attributes> + <lru-entry-count action="overflow-to-disk" maximum="75000"/> + </eviction-attributes> + </region-attributes> + </region> +</cache> + diff --git a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceImpl.java b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceImpl.java index a452ebc..61fe7ec 100644 --- a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceImpl.java +++ b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceImpl.java @@ -167,7 +167,7 @@ public class CqServiceImpl implements CqService { this.matchingCqMap = new ConcurrentHashMap<String, HashSet<String>>(); // Initialize the VSD statistics - this.cqServiceVsdStats = StatsFactory.createStatsImpl(CqServiceVsdStats.class, null); + this.cqServiceVsdStats = StatsFactory.createStatsImpl(CqServiceVsdStats.class, "CqServiceImpl"); // This won't be converted to a Micrometer stat, as this is not really a stat, but merely a // wrapper // around a stat Impl diff --git a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCachePerfStats.kt b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCachePerfStats.kt index 1823516..eb258c3 100644 --- a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCachePerfStats.kt +++ b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCachePerfStats.kt @@ -936,9 +936,7 @@ open class MicrometerCachePerfStats @JvmOverloads constructor(statisticsFactory: override fun getDiskTasksWaiting(): Int = diskTasksWaitingMeter.getValue().toInt() @Deprecated("The method is deprecated to be removed, but here until a better stats mechanism is found") - override fun getStats(): Statistics { - TODO("not implemented") - } + override fun getStats(): Statistics? = null @Deprecated("The method is deprecated to be removed, but here until a better stats mechanism is found") override fun getClearCount(): Int = regionClearMeter.getValue().toInt() diff --git a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/internal/micrometer/impl/MicrometerStatisticsManager.kt b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/internal/micrometer/impl/MicrometerStatisticsManager.kt index a667c47..9db85a0 100644 --- a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/internal/micrometer/impl/MicrometerStatisticsManager.kt +++ b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/internal/micrometer/impl/MicrometerStatisticsManager.kt @@ -91,15 +91,15 @@ object MicrometerStatisticsManager : StatisticsManager { private fun createCompositeRegistry(): CompositeMeterRegistry { val compositeMeterRegistry = CompositeMeterRegistry(Clock.SYSTEM) - if (System.getProperty("geode.metrics.influxdb.enabled")?.toBoolean() == true) { +// if (System.getProperty("geode.metrics.influxdb.enabled")?.toBoolean() == true) { compositeMeterRegistry.add(createInfluxDB()) - } - if (System.getProperty("geode.metrics.prometheus.enabled")?.toBoolean() == true) { - compositeMeterRegistry.add(createPrometheus()) - } - if (System.getProperty("geode.metrics.jmx.enabled")?.toBoolean() == true) { - compositeMeterRegistry.add(createJMX()) - } +// } +// if (System.getProperty("geode.metrics.prometheus.enabled")?.toBoolean() == true) { +// compositeMeterRegistry.add(createPrometheus()) +// } +// if (System.getProperty("geode.metrics.jmx.enabled")?.toBoolean() == true) { +// compositeMeterRegistry.add(createJMX()) +// } return compositeMeterRegistry } @@ -119,7 +119,7 @@ object MicrometerStatisticsManager : StatisticsManager { override fun get(k: String): String? = null override fun uri(): String = "http://" + "${System.getProperty("geode.metrics.influxdb.address") - ?: "35.188.47.210"}:8086" + ?: "localhost"}:8086" } return InfluxMeterRegistry(config, Clock.SYSTEM) } diff --git a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/micrometer/MicrometerStatisticsFactoryImpl.kt b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/micrometer/MicrometerStatisticsFactoryImpl.kt index 96414fd..64f55ce 100644 --- a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/micrometer/MicrometerStatisticsFactoryImpl.kt +++ b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/micrometer/MicrometerStatisticsFactoryImpl.kt @@ -26,7 +26,8 @@ import org.apache.geode.stats.common.statistics.StatisticsType import org.apache.geode.stats.common.statistics.factory.StatsFactory import java.io.Reader -class MicrometerStatisticsFactoryImpl(vararg meterRegistries: MeterRegistry = arrayOf(SimpleMeterRegistry())) : StatisticsFactory { +class MicrometerStatisticsFactoryImpl @JvmOverloads constructor(vararg meterRegistries: MeterRegistry = + arrayOf(SimpleMeterRegistry())) : StatisticsFactory { private val micrometerStatisticsManager = MicrometerStatisticsManager.createWithRegistries(meterRegistries) private val meterGroupMap = hashMapOf<String, StatisticsType>() diff --git a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/wan/MicrometerGatewaySenderStats.kt b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/wan/MicrometerGatewaySenderStats.kt index 0b75938..2275bd7 100644 --- a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/wan/MicrometerGatewaySenderStats.kt +++ b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/wan/MicrometerGatewaySenderStats.kt @@ -14,17 +14,18 @@ */ package org.apache.geode.statistics.wan -import org.apache.geode.stats.common.internal.cache.wan.GatewaySenderStats -import org.apache.geode.stats.common.statistics.Statistics -import org.apache.geode.stats.common.statistics.StatisticsFactory import org.apache.geode.statistics.internal.micrometer.impl.CounterStatisticMeter import org.apache.geode.statistics.internal.micrometer.impl.GaugeStatisticMeter import org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup import org.apache.geode.statistics.internal.micrometer.impl.TimerStatisticMeter +import org.apache.geode.statistics.micrometer.MicrometerStatsImplementer import org.apache.geode.statistics.util.NOW_NANOS +import org.apache.geode.stats.common.internal.cache.wan.GatewaySenderStats +import org.apache.geode.stats.common.statistics.Statistics +import org.apache.geode.stats.common.statistics.StatisticsFactory open class MicrometerGatewaySenderStats @JvmOverloads constructor(statisticsFactory: StatisticsFactory, private val queueName: String, private val groupName: String = "GatewayReceiverStats-$queueName") : - MicrometerMeterGroup(statisticsFactory, groupName), GatewaySenderStats { + MicrometerMeterGroup(statisticsFactory, groupName), GatewaySenderStats, MicrometerStatsImplementer { override fun getGroupTags(): Array<String> = arrayOf("gatewaySenderName", queueName) diff --git a/geode-stats-common/src/main/java/org/apache/geode/stats/common/statistics/factory/StatsFactory.java b/geode-stats-common/src/main/java/org/apache/geode/stats/common/statistics/factory/StatsFactory.java index ed6aac6..3223dcc 100644 --- a/geode-stats-common/src/main/java/org/apache/geode/stats/common/statistics/factory/StatsFactory.java +++ b/geode-stats-common/src/main/java/org/apache/geode/stats/common/statistics/factory/StatsFactory.java @@ -22,10 +22,7 @@ import java.util.Map; import java.util.ServiceLoader; import org.reflections.Reflections; -import org.reflections.scanners.SubTypesScanner; import org.reflections.util.ClasspathHelper; -import org.reflections.util.ConfigurationBuilder; -import org.reflections.util.FilterBuilder; import org.apache.geode.stats.common.Stats; import org.apache.geode.stats.common.cache.client.internal.ConnectionStats; @@ -56,11 +53,12 @@ public class StatsFactory { classLoadersList.add(ClasspathHelper.staticClassLoader()); /* don't exclude Object.class */ - Reflections reflections = new Reflections(new ConfigurationBuilder() - .setScanners(new SubTypesScanner(false /* don't exclude Object.class */)) - .setUrls(ClasspathHelper.forClassLoader(classLoadersList.toArray(new ClassLoader[0]))) - .filterInputsBy(new FilterBuilder() - .includePackage("org.apache.geode..*"))); + // Reflections reflections = new Reflections(new ConfigurationBuilder() + // .setScanners(new SubTypesScanner(false /* don't exclude Object.class */)) + // .setUrls(ClasspathHelper.forClassLoader(classLoadersList.toArray(new ClassLoader[0]))) + // .filterInputsBy(new FilterBuilder() + // .includePackage("org.apache.geode..*"))); + Reflections reflections = new Reflections("org.apache.geode"); this.selectedStatsImplementor = selectedStatsImplementor; this.statisticsFactory = statisticsFactory; initializeStatsImplementations(reflections);
