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
The following commit(s) were added to refs/heads/feature/Micrometer by this
push:
new c5598c9 WIP: First working commit with Micrometer using existing
Statistics interfaces.
c5598c9 is described below
commit c5598c97e69c1299687da0660b017e4866fee3b5
Author: Udo Kohlmeyer <[email protected]>
AuthorDate: Wed Jul 25 09:34:11 2018 -0700
WIP: First working commit with Micrometer using existing Statistics
interfaces.
---
.../apache/geode/statistics/StatisticsType.java | 5 +
.../geode/statistics/StatisticsTypeFactory.java | 105 +++++++++++----------
geode-core/build.gradle | 23 ++++-
.../asyncqueue/internal/AsyncEventQueueStats.java | 4 +
.../internal/InternalDistributedSystem.java | 57 +++++++++--
.../distributed/internal/InternalLocator.java | 102 +++++++++++++-------
.../geode/internal/cache/CachePerfStats.java | 10 +-
.../geode/internal/cache/GemFireCacheImpl.java | 2 +-
.../apache/geode/internal/concurrent/Atomics.java | 2 +-
.../statistics/AbstractStatisticsFactory.java | 4 +-
.../statistics/InternalDistributedSystemStats.java | 100 +++++++++++++-------
.../statistics/LocalStatisticsFactory.java | 4 +-
.../internal/statistics/LocalStatisticsImpl.java | 2 +-
.../geode/internal/statistics/StatisticsImpl.java | 4 +-
.../internal/statistics/StatisticsTypeImpl.java | 3 +
.../internal/stats50/Atomic50StatisticsImpl.java | 3 +-
.../geode/management/internal/LocalManager.java | 16 +---
geode-core/src/main/kotlin/Locator.kt | 19 ++++
geode-core/src/main/kotlin/Server.kt | 33 +++++++
.../gms/locator/GMSLocatorRecoveryJUnitTest.java | 8 +-
.../ParallelQueueRemovalMessageJUnitTest.java | 5 +-
.../statistics/DiskSpaceLimitIntegrationTest.java | 1 -
.../statistics/FileSizeLimitIntegrationTest.java | 1 -
.../internal/statistics/LinuxSystemStatsTest.java | 5 +-
...rchiveWithConsecutiveResourceInstGenerator.java | 2 +-
...chiveWithMissingResourceTypeRegressionTest.java | 1 -
.../StatArchiveWriterReaderIntegrationTest.java | 16 +++-
.../statistics/StatSamplerIntegrationTest.java | 1 -
.../StatTypesAreRolledOverRegressionTest.java | 1 -
.../statistics/StatisticsDistributedTest.java | 2 +-
.../internal/statistics/TestStatisticsManager.java | 3 +-
.../internal/stats50/AtomicStatsJUnitTest.java | 2 +-
.../bean/stats/AsyncEventQueueStatsJUnitTest.java | 2 +-
.../internal/micrometer/StatisticsManager.kt | 3 +
.../micrometer/impl/MicrometerStatisticMeter.kt | 13 ++-
.../micrometer/impl/MicrometerStatisticsManager.kt | 8 +-
.../micrometer/MicrometerStatisticsFactoryImpl.kt | 15 ++-
.../micrometer/MicrometerStatisticsType.kt | 4 +
.../v1/ProtobufProtocolServiceJUnitTest.java | 38 --------
...ueueOverflowMBeanAttributesDistributedTest.java | 4 +-
...nderOverflowMBeanAttributesDistributedTest.java | 4 +-
41 files changed, 410 insertions(+), 227 deletions(-)
diff --git
a/geode-common/src/main/java/org/apache/geode/statistics/StatisticsType.java
b/geode-common/src/main/java/org/apache/geode/statistics/StatisticsType.java
index 6bbd04b..a21d4ba 100644
--- a/geode-common/src/main/java/org/apache/geode/statistics/StatisticsType.java
+++ b/geode-common/src/main/java/org/apache/geode/statistics/StatisticsType.java
@@ -58,4 +58,9 @@ public interface StatisticsType {
*/
StatisticDescriptor nameToDescriptor(String name);
+ int getIntStatCount();
+
+ int getLongStatCount();
+
+ int getDoubleStatCount();
}
diff --git
a/geode-common/src/main/java/org/apache/geode/statistics/StatisticsTypeFactory.java
b/geode-common/src/main/java/org/apache/geode/statistics/StatisticsTypeFactory.java
index 110d20a..aeaaab9 100644
---
a/geode-common/src/main/java/org/apache/geode/statistics/StatisticsTypeFactory.java
+++
b/geode-common/src/main/java/org/apache/geode/statistics/StatisticsTypeFactory.java
@@ -35,55 +35,52 @@ import java.io.Reader;
* two stats whose values always increase:
*
* <pre>
- StatisticsTypeFactory f = ...;
- StatisticsType t = f.createType(
- "StatSampler",
- "Stats on the statistic sampler.",
- new StatisticDescriptor[] {
- f.createIntCounter("sampleCount",
- "Total number of samples taken by this
sampler.",
- "samples"),
- f.createLongCounter("sampleTime",
- "Total amount of time spent taking samples.",
- "milliseconds"),
- }
- );
+ * StatisticsTypeFactory f = ...;
+ * StatisticsType t = f.createType(
+ * "StatSampler",
+ * "Stats on the statistic sampler.",
+ * new StatisticDescriptor[] {
+ * f.createIntCounter("sampleCount",
+ * "Total number of samples taken by this sampler.",
+ * "samples"),
+ * f.createLongCounter("sampleTime",
+ * "Total amount of time spent taking samples.",
+ * "milliseconds"),
+ * }
+ * );
* </pre>
* <P>
* The following is an example of how to create the same type using XML. The
XML data:
*
* <pre>
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE statistics PUBLIC
- "-//GemStone Systems, Inc.//GemFire Statistics Type//EN"
- "http://www.gemstone.com/dtd/statisticsType.dtd">
- <statistics>
- <type name="StatSampler">
- <description>Stats on the statistic sampler.</description>
- <stat name="sampleCount" storage="int" counter="true">
- <description>Total number of samples taken by this
sampler.</description>
- <unit>samples</unit>
- </stat>
- <stat name="sampleTime" storage="long" counter="true">
- <description>Total amount of time spent taking
samples.</description>
- <unit>milliseconds</unit>
- </stat>
- </type>
- </statistics>
+ * <?xml version="1.0" encoding="UTF-8"?>
+ * <!DOCTYPE statistics PUBLIC
+ * "-//GemStone Systems, Inc.//GemFire Statistics Type//EN"
+ * "http://www.gemstone.com/dtd/statisticsType.dtd">
+ * <statistics>
+ * <type name="StatSampler">
+ * <description>Stats on the statistic sampler.</description>
+ * <stat name="sampleCount" storage="int" counter="true">
+ * <description>Total number of samples taken by this
sampler.</description>
+ * <unit>samples</unit>
+ * </stat>
+ * <stat name="sampleTime" storage="long" counter="true">
+ * <description>Total amount of time spent taking
samples.</description>
+ * <unit>milliseconds</unit>
+ * </stat>
+ * </type>
+ * </statistics>
* </pre>
*
* The code to create the type:
*
* <pre>
- StatisticsTypeFactory f = ...;
- Reader r = new InputStreamReader("fileContainingXmlData"));
- StatisticsType type = f.createTypesFromXml(r)[0];
+ * StatisticsTypeFactory f = ...;
+ * Reader r = new InputStreamReader("fileContainingXmlData"));
+ * StatisticsType type = f.createTypesFromXml(r)[0];
* </pre>
* <P>
- *
* @see <A href="package-summary.html#statistics">Package introduction</A>
- *
- *
* @since GemFire 3.0
*/
public interface StatisticsTypeFactory {
@@ -132,45 +129,49 @@ public interface StatisticsTypeFactory {
/**
* Creates and returns an int counter {@link StatisticDescriptor} with the
given
- * <code>name</code>, <code>description</code>, <code>largerBetter</code>,
and <code>units</code>.
+ * <code>name</code>, <code>description</code>, <code>largerBetter</code>,
and
+ * <code>units</code>.
*/
StatisticDescriptor createIntCounter(String name, String description, String
units,
- boolean largerBetter);
+ boolean largerBetter);
/**
* Creates and returns a long counter {@link StatisticDescriptor} with the
given
- * <code>name</code>, <code>description</code>, <code>largerBetter</code>,
and <code>units</code>.
+ * <code>name</code>, <code>description</code>, <code>largerBetter</code>,
and
+ * <code>units</code>.
*/
StatisticDescriptor createLongCounter(String name, String description,
String units,
- boolean largerBetter);
+ boolean largerBetter);
/**
* Creates and returns a double counter {@link StatisticDescriptor} with the
given
- * <code>name</code>, <code>description</code>, <code>largerBetter</code>,
and <code>units</code>.
+ * <code>name</code>, <code>description</code>, <code>largerBetter</code>,
and
+ * <code>units</code>.
*/
StatisticDescriptor createDoubleCounter(String name, String description,
String units,
- boolean largerBetter);
+ boolean largerBetter);
/**
* Creates and returns an int gauge {@link StatisticDescriptor} with the
given <code>name</code>,
* <code>description</code>, <code>largerBetter</code>, and
<code>units</code>.
*/
StatisticDescriptor createIntGauge(String name, String description, String
units,
- boolean largerBetter);
+ boolean largerBetter);
/**
* Creates and returns a long gauge {@link StatisticDescriptor} with the
given <code>name</code>,
* <code>description</code>, <code>largerBetter</code>, and
<code>units</code>.
*/
StatisticDescriptor createLongGauge(String name, String description, String
units,
- boolean largerBetter);
+ boolean largerBetter);
/**
* Creates and returns a double gauge {@link StatisticDescriptor} with the
given
- * <code>name</code>, <code>description</code>, <code>largerBetter</code>,
and <code>units</code>.
+ * <code>name</code>, <code>description</code>, <code>largerBetter</code>,
and
+ * <code>units</code>.
*/
StatisticDescriptor createDoubleGauge(String name, String description,
String units,
- boolean largerBetter);
+ boolean largerBetter);
/**
@@ -183,9 +184,8 @@ public interface StatisticsTypeFactory {
/**
* Creates or finds and returns a {@link StatisticsType} with the given
<code>name</code>,
* <code>description</code>, and {@link StatisticDescriptor statistic
descriptions}.
- *
* @throws IllegalArgumentException if a type with the given
<code>name</code> already exists and
- * it differs from the given parameters.
+ * it differs from the given parameters.
*/
StatisticsType createType(String name, String description,
StatisticDescriptor[] stats);
@@ -198,12 +198,15 @@ public interface StatisticsTypeFactory {
/**
* Creates one or more {@link StatisticsType} from the contents of the given
<code>reader</code>.
* The created types can be found by calling {@link #findType}.
- *
* @param reader The source of the XML data which must comply with the
- * <code>statisticsType.dtd</code>.
- *
+ * <code>statisticsType.dtd</code>.
* @throws IllegalArgumentException if a type defined in the reader already
exists
* @throws IOException Something went wrong while reading from
<code>reader</code>
*/
StatisticsType[] createTypesFromXml(Reader reader) throws IOException;
+
+ default Statistics createOsStatistics(StatisticsType type, String textId,
long numericId,
+ int osStatFlags) {
+ return null;
+ }
}
diff --git a/geode-core/build.gradle b/geode-core/build.gradle
index 0be1c4f..ae74950 100755
--- a/geode-core/build.gradle
+++ b/geode-core/build.gradle
@@ -18,15 +18,32 @@
apply plugin: 'antlr'
apply plugin: 'me.champeau.gradle.jmh'
+apply plugin: 'kotlin'
sourceSets {
jca {
compileClasspath += configurations.compile
runtimeClasspath += configurations.runtime
}
+ main.kotlin.srcDirs += 'src/main/kotlin'
}
+sourceCompatibility = 1.8
+targetCompatibility = sourceCompatibility
+compileKotlin { kotlinOptions.jvmTarget = sourceCompatibility }
+compileTestKotlin { kotlinOptions.jvmTarget = sourceCompatibility }
+buildscript {
+ ext.kotlin_version = '1.2.51'
+
+ repositories {
+ mavenCentral()
+ }
+
+ dependencies {
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ }
+}
configurations {
//declaring new configuration that will be used to associate with artifacts
@@ -38,7 +55,11 @@ dependencies {
antlr 'antlr:antlr:' + project.'antlr.version'
// External
- compileOnly project(':geode-micrometer-stats')
+ compile project(':geode-micrometer-stats')
+ compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
+ compile 'io.micrometer:micrometer-registry-influx:latest.release'
+ compile 'io.micrometer:micrometer-registry-jmx:latest.release'
+
compileOnly files("${System.getProperty('java.home')}/../lib/tools.jar")
testCompile files("${System.getProperty('java.home')}/../lib/tools.jar")
diff --git
a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueStats.java
b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueStats.java
index d4dd853..193e3a0 100644
---
a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueStats.java
+++
b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueStats.java
@@ -158,4 +158,8 @@ public class AsyncEventQueueStats extends
GatewaySenderStats {
initializeStats(factory);
this.stats = factory.createAtomicStatistics(type, "asyncEventQueueStats-"
+ asyncQueueId);
}
+
+ public StatisticsType getType() {
+ return type;
+ }
}
diff --git
a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
index fa38b24..1c0cf38 100644
---
a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
+++
b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
@@ -22,6 +22,7 @@ import java.io.File;
import java.io.IOException;
import java.lang.reflect.Array;
import java.net.InetAddress;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -40,6 +41,12 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
+import io.micrometer.core.instrument.Clock;
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.influx.InfluxConfig;
+import io.micrometer.influx.InfluxMeterRegistry;
+import io.micrometer.jmx.JmxConfig;
+import io.micrometer.jmx.JmxMeterRegistry;
import org.apache.logging.log4j.Logger;
import org.apache.geode.CancelCriterion;
@@ -105,6 +112,7 @@ import org.apache.geode.management.ManagementException;
import org.apache.geode.security.GemFireSecurityException;
import org.apache.geode.security.PostProcessor;
import org.apache.geode.security.SecurityManager;
+import org.apache.geode.statistics.micrometer.MicrometerStatisticsFactoryImpl;
/**
* The concrete implementation of {@link DistributedSystem} that provides
internal-only
@@ -149,7 +157,7 @@ public class InternalDistributedSystem extends
DistributedSystem {
/**
* The IDS StatiticsManager, StatisticsFactory and OsStatsFactory
*/
- private final InternalDistributedSystemStats internalDistributedSystemStats;
+ private InternalDistributedSystemStats internalDistributedSystemStats;
/**
* The distribution manager that is used to communicate with the distributed
system.
@@ -520,9 +528,6 @@ public class InternalDistributedSystem extends
DistributedSystem {
this.creationStack =
TEST_CREATION_STACK_GENERATOR.get().generateCreationStack(this.originalConfig);
-
- this.internalDistributedSystemStats = new
InternalDistributedSystemStats(this.statsDisabled,this.getConfig(),
- this,new StatisticsTypeFactoryImpl());
}
//////////////////// Instance Methods ////////////////////
@@ -604,6 +609,40 @@ public class InternalDistributedSystem extends
DistributedSystem {
}
}
+ private void initializeStats() {
+ MeterRegistry influxRegistry = new InfluxMeterRegistry(new InfluxConfig() {
+ @Override
+ public Duration step() {
+ return Duration.ofSeconds(10);
+ }
+
+ @Override
+ public String db() {
+ return "mydb";
+ }
+
+ @Override
+ public String get(String k) {
+ return null; // accept the rest of the defaults
+ }
+ }, Clock.SYSTEM);
+
+ MeterRegistry jmxRegistry = new JmxMeterRegistry(new JmxConfig() {
+ @Override
+ public Duration step() {
+ return Duration.ofSeconds(10);
+ }
+
+ @Override
+ public String get(String k) {
+ return null; // accept the rest of the defaults
+ }
+ }, Clock.SYSTEM);
+ this.internalDistributedSystemStats =
InternalDistributedSystemStats.createInstance(this.statsDisabled,this.getConfig(),
+// this,new StatisticsTypeFactoryImpl());
+ this,new MicrometerStatisticsFactoryImpl(influxRegistry,jmxRegistry));
+ }
+
/**
* Initializes this connection to a distributed system with the current
configuration state.
@@ -735,16 +774,18 @@ public class InternalDistributedSystem extends
DistributedSystem {
logger.info("Finished locking memory.");
}
+ synchronized (this.isConnectedMutex) {
+ this.isConnected = true;
+ }
+
+ initializeStats();
+
try {
startInitLocator();
} catch (InterruptedException e) {
throw new SystemConnectException("Startup has been interrupted", e);
}
- synchronized (this.isConnectedMutex) {
- this.isConnected = true;
- }
-
if (!this.isLoner) {
try {
if (this.quorumChecker != null) {
diff --git
a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
index e4bdb52..bf4fe4f 100644
---
a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
+++
b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.net.ConnectException;
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.time.Duration;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -33,6 +34,12 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
+import io.micrometer.core.instrument.Clock;
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.influx.InfluxConfig;
+import io.micrometer.influx.InfluxMeterRegistry;
+import io.micrometer.jmx.JmxConfig;
+import io.micrometer.jmx.JmxMeterRegistry;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.logging.log4j.Logger;
@@ -74,12 +81,14 @@ import
org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.internal.logging.log4j.LogWriterAppenders;
import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.net.SocketCreatorFactory;
+import org.apache.geode.internal.statistics.InternalDistributedSystemStats;
import org.apache.geode.management.internal.JmxManagerLocator;
import org.apache.geode.management.internal.JmxManagerLocatorRequest;
import
org.apache.geode.management.internal.configuration.domain.SharedConfigurationStatus;
import
org.apache.geode.management.internal.configuration.handlers.SharedConfigurationStatusRequestHandler;
import
org.apache.geode.management.internal.configuration.messages.SharedConfigurationStatusRequest;
import
org.apache.geode.management.internal.configuration.messages.SharedConfigurationStatusResponse;
+import org.apache.geode.statistics.micrometer.MicrometerStatisticsFactoryImpl;
/**
* Provides the implementation of a distribution {@code Locator} as well as
internal-only
@@ -94,7 +103,6 @@ import
org.apache.geode.management.internal.configuration.messages.SharedConfigu
* The startLocator() methods provide a way to start all three services in one
call. Otherwise, the
* services can be started independently {@code locator = createLocator();
* locator.startPeerLocation(); locator.startDistributeSystem();}
- *
* @since GemFire 4.0
*/
public class InternalLocator extends Locator implements ConnectListener {
@@ -241,18 +249,19 @@ public class InternalLocator extends Locator implements
ConnectListener {
* Create a locator that listens on a given port. This locator will not have
peer or server
* location services available until they are started by calling
startServerLocation or
* startPeerLocation on the locator object.
- *
* @param port the tcp/ip port to listen on
* @param logFile the file that log messages should be written to
* @param logger a log writer that should be used (logFile parameter is
ignored)
* @param securityLogger the logger to be used for security related log
messages
* @param distributedSystemProperties optional properties to configure the
distributed system
- * (e.g., mcast addr/port, other locators)
+ * (e.g., mcast addr/port, other locators)
* @param startDistributedSystem if true then this locator will also start
its own ds
*/
public static InternalLocator createLocator(int port, File logFile,
InternalLogWriter logger,
- InternalLogWriter securityLogger, InetAddress bindAddress, String
hostnameForClients,
- Properties distributedSystemProperties, boolean startDistributedSystem) {
+ InternalLogWriter securityLogger,
+ InetAddress bindAddress, String
hostnameForClients,
+ Properties
distributedSystemProperties,
+ boolean startDistributedSystem) {
synchronized (locatorLock) {
if (hasLocator()) {
throw new IllegalStateException(
@@ -280,19 +289,21 @@ public class InternalLocator extends Locator implements
ConnectListener {
* Creates a distribution locator that runs in this VM on the given port and
bind address.
* <p>
* This is for internal use only as it does not create a distributed system
unless told to do so.
- *
* @param port the tcp/ip port to listen on
* @param logFile the file that log messages should be written to
* @param logger a log writer that should be used (logFile parameter is
ignored)
* @param securityLogger the logger to be used for security related log
messages
* @param startDistributedSystem if true, a distributed system is started
* @param dsProperties optional properties to configure the distributed
system (e.g., mcast
- * addr/port, other locators)
+ * addr/port, other locators)
* @param hostnameForClients the name to give to clients for connecting to
this locator
*/
public static InternalLocator startLocator(int port, File logFile,
InternalLogWriter logger,
- InternalLogWriter securityLogger, InetAddress bindAddress, boolean
startDistributedSystem,
- Properties dsProperties, String hostnameForClients) throws IOException {
+ InternalLogWriter securityLogger,
+ InetAddress bindAddress,
+ boolean startDistributedSystem,
+ Properties dsProperties, String
hostnameForClients)
+ throws IOException {
System.setProperty(FORCE_LOCATOR_DM_TYPE, "true");
InternalLocator newLocator = null;
@@ -303,6 +314,8 @@ public class InternalLocator extends Locator implements
ConnectListener {
newLocator = createLocator(port, logFile, logger, securityLogger,
bindAddress,
hostnameForClients, dsProperties, startDistributedSystem);
+ newLocator.stats = new LocatorStats(initializeStats(newLocator));
+
try {
newLocator.startPeerLocation();
@@ -347,6 +360,42 @@ public class InternalLocator extends Locator implements
ConnectListener {
}
}
+ private static InternalDistributedSystemStats
initializeStats(InternalLocator newLocator) {
+ MeterRegistry influxRegistry = new InfluxMeterRegistry(new InfluxConfig() {
+ @Override
+ public Duration step() {
+ return Duration.ofSeconds(10);
+ }
+
+ @Override
+ public String db() {
+ return "mydb";
+ }
+
+ @Override
+ public String get(String k) {
+ return null; // accept the rest of the defaults
+ }
+ }, Clock.SYSTEM);
+
+ MeterRegistry jmxRegistry = new JmxMeterRegistry(new JmxConfig() {
+ @Override
+ public Duration step() {
+ return Duration.ofSeconds(10);
+ }
+
+ @Override
+ public String get(String k) {
+ return null; // accept the rest of the defaults
+ }
+ }, Clock.SYSTEM);
+ return InternalDistributedSystemStats
+ .createInstance(newLocator.config.statisticSamplingEnabled,
newLocator.getConfig(),
+// this,new StatisticsTypeFactoryImpl());
+ (InternalDistributedSystem) newLocator.getDistributedSystem(),
+ new MicrometerStatisticsFactoryImpl(influxRegistry, jmxRegistry));
+ }
+
/***
* Determines if this VM is a locator which must ignore a shutdown.
*
@@ -373,21 +422,21 @@ public class InternalLocator extends Locator implements
ConnectListener {
/**
* Creates a new {@code Locator} with the given port, log file, logger, and
bind address.
- *
* @param port the tcp/ip port to listen on
* @param logF the file that log messages should be written to
* @param logWriter a log writer that should be used (logFile parameter is
ignored)
* @param securityLogWriter the log writer to be used for security related
log messages
* @param hostnameForClients the name to give to clients for connecting to
this locator
* @param distributedSystemProperties optional properties to configure the
distributed system
- * (e.g., mcast addr/port, other locators)
+ * (e.g., mcast addr/port, other locators)
* @param cfg the config if being called from a distributed system;
otherwise null.
* @param startDistributedSystem if true locator will start its own
distributed system
*/
private InternalLocator(int port, File logF, InternalLogWriter logWriter,
- InternalLogWriter securityLogWriter,
- InetAddress bindAddress, String hostnameForClients, Properties
distributedSystemProperties,
- DistributionConfigImpl cfg, boolean startDistributedSystem) {
+ InternalLogWriter securityLogWriter,
+ InetAddress bindAddress, String hostnameForClients,
+ Properties distributedSystemProperties,
+ DistributionConfigImpl cfg, boolean
startDistributedSystem) {
// TODO: the following three assignments are already done in superclass
this.logFile = logF;
@@ -472,7 +521,7 @@ public class InternalLocator extends Locator implements
ConnectListener {
this.handler = new PrimaryHandler(this, locatorListener);
ThreadGroup group = LoggingThreadGroup.createThreadGroup("Distribution
locators", logger);
- this.stats = new
LocatorStats(this.getDistributedSystem().getStatisticsFactory());
+// this.stats = new
LocatorStats(this.getDistributedSystem().getStatisticsFactory());
this.server = new TcpServerFactory().makeTcpServer(port, this.bindAddress,
null, this.config,
this.handler, new DelayedPoolStatHelper(), group, this.toString(),
this);
@@ -501,7 +550,6 @@ public class InternalLocator extends Locator implements
ConnectListener {
/**
* Start peer location in this locator. If you plan on starting a
distributed system later, this
* method should be called first so that the distributed system can use this
locator.
- *
* @return returns the port that the locator to which the locator is bound
* @since GemFire 5.7
*/
@@ -557,13 +605,14 @@ public class InternalLocator extends Locator implements
ConnectListener {
* For backward-compatibility we retain this method
* <p>
* TODO: parameters peerLocator and serverLocator and b1 are never used
- *
* @deprecated use a form of the method that does not have
peerLocator/serverLocator parameters
*/
@Deprecated
public static InternalLocator startLocator(int locatorPort, File logFile,
- InternalLogWriter logger, InternalLogWriter logger1, InetAddress addr,
- Properties dsProperties, boolean peerLocator, boolean serverLocator,
String s, boolean b1)
+ InternalLogWriter logger,
InternalLogWriter logger1,
+ InetAddress addr,
+ Properties dsProperties, boolean
peerLocator,
+ boolean serverLocator, String s,
boolean b1)
throws IOException {
return startLocator(locatorPort, logFile, logger, logger1, addr, true,
dsProperties, s);
}
@@ -572,7 +621,6 @@ public class InternalLocator extends Locator implements
ConnectListener {
* Start a distributed system whose life cycle is managed by this locator.
When the locator is
* stopped, this distributed system will be disconnected. If a distributed
system already exists,
* this method will have no affect.
- *
* @since GemFire 5.7
*/
private void startDistributedSystem() throws UnknownHostException {
@@ -593,7 +641,6 @@ public class InternalLocator extends Locator implements
ConnectListener {
sb.append('[').append(getPort()).append(']');
String thisLocator = sb.toString();
-
if (this.peerLocator) {
// append this locator to the locators list from the config properties
// this.logger.config("ensuring that this locator is in the locators
list");
@@ -669,9 +716,7 @@ public class InternalLocator extends Locator implements
ConnectListener {
/**
* End the initialization of the locator. This method should be called once
the location services
* and distributed system are started.
- *
* @param distributedSystem The distributed system to use for the statistics.
- *
* @since GemFire 5.7
*/
void endStartLocator(InternalDistributedSystem distributedSystem) {
@@ -695,10 +740,8 @@ public class InternalLocator extends Locator implements
ConnectListener {
/**
* Start server location services in this locator. Server location can only
be started once there
* is a running distributed system.
- *
* @param distributedSystem The distributed system which the server location
services should use.
- * If null, the method will try to find an already connected
distributed system.
- *
+ * If null, the method will try to find an already connected distributed
system.
* @since GemFire 5.7
*/
void startServerLocation(InternalDistributedSystem distributedSystem) throws
IOException {
@@ -747,7 +790,6 @@ public class InternalLocator extends Locator implements
ConnectListener {
/**
* Stop this locator
- *
* @param stopForReconnect - stopping for distributed system reconnect
* @param waitForDisconnect - wait up to 60 seconds for the locator to
completely stop
*/
@@ -880,7 +922,6 @@ public class InternalLocator extends Locator implements
ConnectListener {
/**
* Waits for a locator to be told to stop.
- *
* @throws InterruptedException thrown if the thread is interrupted
*/
public void waitToStop() throws InterruptedException {
@@ -953,7 +994,6 @@ public class InternalLocator extends Locator implements
ConnectListener {
* succeeds. It will then wait for the system to finish reconnecting before
returning. If quorum
* checks are not being done this merely waits for the distributed system to
reconnect and then
* starts location services.
- *
* @return true if able to reconnect the locator to the new distributed
system
*/
private boolean attemptReconnect() throws InterruptedException, IOException {
@@ -1090,7 +1130,6 @@ public class InternalLocator extends Locator implements
ConnectListener {
/**
* Return the port on which the locator is actually listening. If called
before the locator has
* actually started, this method will return null.
- *
* @return the port the locator is listening on or null if it has not yet
been started
*/
@Override
@@ -1167,7 +1206,7 @@ public class InternalLocator extends Locator implements
ConnectListener {
@Override
public void restarting(DistributedSystem ds, GemFireCache cache,
- InternalConfigurationPersistenceService sharedConfig) {
+ InternalConfigurationPersistenceService
sharedConfig) {
if (ds != null) {
for (TcpHandler handler : this.allHandlers) {
handler.restarting(ds, cache, sharedConfig);
@@ -1273,7 +1312,6 @@ public class InternalLocator extends Locator implements
ConnectListener {
/**
* Returns collection of locator strings representing every locator instance
hosted by this
* member.
- *
* @see #getLocators()
*/
public static Collection<String> getLocatorStrings() {
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/cache/CachePerfStats.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/CachePerfStats.java
index 85bcb85..492ac78 100644
---
a/geode-core/src/main/java/org/apache/geode/internal/cache/CachePerfStats.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/cache/CachePerfStats.java
@@ -19,11 +19,9 @@ import org.apache.geode.statistics.StatisticDescriptor;
import org.apache.geode.statistics.Statistics;
import org.apache.geode.statistics.StatisticsFactory;
import org.apache.geode.statistics.StatisticsType;
-import org.apache.geode.statistics.StatisticsTypeFactory;
import org.apache.geode.distributed.internal.PoolStatHelper;
import org.apache.geode.distributed.internal.QueueStatHelper;
import org.apache.geode.internal.NanoTimer;
-import org.apache.geode.internal.statistics.StatisticsTypeFactoryImpl;
/**
* CachePerfStats tracks statistics about GemFire cache performance.
@@ -332,8 +330,8 @@ public class CachePerfStats {
private static final String evictByCriteria_evaluationTimeDesc = "Total time
taken for evaluation of user expression during eviction";// time taken to
evaluate user expression.
- private void initializeStats(StatisticsFactory factory) {
- type = factory.createType("CachePerfStats", "Statistics about GemFire
cache performance",
+ private void initializeStats(StatisticsFactory factory, String name) {
+ type = factory.createType("CachePerfStats-"+name, "Statistics about
GemFire cache performance",
new StatisticDescriptor[]{
factory.createIntGauge("loadsInProgress", loadsInProgressDesc,
"operations"),
factory.createIntCounter("loadsCompleted", loadsCompletedDesc,
"operations"),
@@ -633,7 +631,7 @@ public class CachePerfStats {
* factory.
*/
public CachePerfStats(StatisticsFactory factory) {
- initializeStats(factory);
+ initializeStats(factory,"" );
stats = factory.createAtomicStatistics(type, "cachePerfStats");
}
@@ -642,7 +640,7 @@ public class CachePerfStats {
* factory.
*/
public CachePerfStats(StatisticsFactory factory, String name) {
- initializeStats(factory);
+ initializeStats(factory,name);
stats = factory.createAtomicStatistics(type, "RegionStats-" + name);
}
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index f8a70bc..3e49299 100755
---
a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -864,7 +864,7 @@ public class GemFireCacheImpl implements InternalCache,
InternalClientCache, Has
this.securityService = SecurityServiceFactory.create();
}
- if (!this.isClient && PoolManager.getAll().isEmpty()) {
+ if (!this.isClient && PoolManager.getAll().isEmpty() &&
this.getSystem().getConfig().getJmxManager()) {
// We only support management on members of a distributed system
// Should do this: if (!getSystem().isLoner()) {
// but it causes quickstart.CqClientTest to hang
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/concurrent/Atomics.java
b/geode-core/src/main/java/org/apache/geode/internal/concurrent/Atomics.java
index a82ef4d..7b82747 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/concurrent/Atomics.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/concurrent/Atomics.java
@@ -39,7 +39,7 @@ public class Atomics {
public static Statistics createAtomicStatistics(StatisticsType type, String
textId, long nId,
long uId, StatisticsManager mgr) {
Statistics result = null;
- if (((StatisticsTypeImpl) type).getDoubleStatCount() == 0 &&
!STRIPED_STATS_DISABLED) {
+ if (type.getDoubleStatCount() == 0 && !STRIPED_STATS_DISABLED) {
result = new Atomic50StatisticsImpl(type, textId, nId, uId, mgr);
} else {
result = new LocalStatisticsImpl(type, textId, nId, uId, true, 0, mgr);
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/statistics/AbstractStatisticsFactory.java
b/geode-core/src/main/java/org/apache/geode/internal/statistics/AbstractStatisticsFactory.java
index 96b8676..b60cc58 100755
---
a/geode-core/src/main/java/org/apache/geode/internal/statistics/AbstractStatisticsFactory.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/statistics/AbstractStatisticsFactory.java
@@ -133,8 +133,8 @@ public abstract class AbstractStatisticsFactory implements
StatisticsFactory, St
return createOsStatistics(type, textId, 0, 0);
}
- protected Statistics createOsStatistics(StatisticsType type, String textId,
long numericId,
- int osStatFlags) {
+ public Statistics createOsStatistics(StatisticsType type, String textId,
long numericId,
+ int osStatFlags) {
long myUniqueId;
synchronized (statsListUniqueIdLock) {
myUniqueId = statsListUniqueId++; // fix for bug 30597
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 51ab5b9..5f65351 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
@@ -20,6 +20,7 @@ import org.apache.geode.statistics.Statistics;
import org.apache.geode.statistics.StatisticsFactory;
import org.apache.geode.statistics.StatisticsType;
import org.apache.geode.statistics.StatisticsTypeFactory;
+import org.apache.geode.statistics.micrometer.MicrometerStatisticsFactoryImpl;
public class InternalDistributedSystemStats
implements StatisticsFactory, StatisticsManager, OsStatisticsFactory {
@@ -35,29 +36,63 @@ public class InternalDistributedSystemStats
// As the function execution stats can be lot in number, its better to put
// them in a map so that it will be accessible immediately
- private final ConcurrentHashMap<String, FunctionStats>
functionExecutionStatsMap = new ConcurrentHashMap<>();
+ private final ConcurrentHashMap<String, FunctionStats>
+ functionExecutionStatsMap =
+ new ConcurrentHashMap<>();
private FunctionServiceStats functionServiceStats;
- private final boolean statsDisabled;
+ private boolean statsDisabled;
// StatisticsTypeFactory methods
- private final StatisticsTypeFactory statisticsTypeFactory;
+ private StatisticsFactory statisticsTypeFactory;
- public InternalDistributedSystemStats(boolean
statsDisabled,DistributionConfig distributionConfig,
+ //TODO, sorry another singleton... BLECH!!
+ private static final InternalDistributedSystemStats
+ singleton =
+ new InternalDistributedSystemStats();
+
+ private InternalDistributedSystemStats() {
+ }
+
+ //TODO Udo: We need to fix the bootstrapping to have DS's and DM's created
in order to get the statsfactory created
+ public InternalDistributedSystemStats(boolean statsDisabled,
+ DistributionConfig distributionConfig,
InternalDistributedSystem
internalDistributedSystem,
StatisticsTypeFactory
statisticsTypeFactory) {
- this.statisticsTypeFactory = statisticsTypeFactory;
+ this.statisticsTypeFactory = (StatisticsFactory) statisticsTypeFactory;
this.statsDisabled = statsDisabled;
this.functionServiceStats = new FunctionServiceStats(this,
"FunctionExecution");
- if (!statsDisabled) {
- this.sampler = new
GemFireStatSampler(internalDistributedSystem.getId(),distributionConfig,
- internalDistributedSystem.getCancelCriterion(),this,
+ if (!statsDisabled && !(statisticsTypeFactory instanceof
MicrometerStatisticsFactoryImpl)) {
+ this.sampler = new GemFireStatSampler(internalDistributedSystem.getId(),
distributionConfig,
+ internalDistributedSystem.getCancelCriterion(), this,
internalDistributedSystem.getDistributionManager());
this.sampler.start();
}
}
+ public static InternalDistributedSystemStats createInstance(boolean
statsDisabled,
+
DistributionConfig distributionConfig,
+
InternalDistributedSystem distributedSystem,
+
MicrometerStatisticsFactoryImpl statisticsTypeFactory) {
+
+ singleton.statisticsTypeFactory = statisticsTypeFactory;
+ singleton.statsDisabled = statsDisabled;
+ singleton.functionServiceStats = new FunctionServiceStats(singleton,
"FunctionExecution");
+ if (!statsDisabled && !(statisticsTypeFactory instanceof
MicrometerStatisticsFactoryImpl)) {
+ singleton.sampler = new GemFireStatSampler(distributedSystem.getId(),
distributionConfig,
+ distributedSystem.getCancelCriterion(), singleton,
+ distributedSystem.getDistributionManager());
+ singleton.sampler.start();
+
+ }
+ return singleton;
+ }
+
+ public static InternalDistributedSystemStats getSingleton() {
+ return singleton;
+ }
+
@Override
public int getStatListModCount() {
return this.statsListModCount;
@@ -123,28 +158,13 @@ public class InternalDistributedSystemStats
}
public Statistics createStatistics(StatisticsType type, String textId) {
- return createOsStatistics(type, textId, 0, 0);
+ return statisticsTypeFactory.createOsStatistics(type, textId, 0, 0);
}
public Statistics createStatistics(StatisticsType type, String textId, long
numericId) {
return createOsStatistics(type, textId, numericId, 0);
}
- public Statistics createOsStatistics(StatisticsType type, String textId,
long numericId,
- int osStatFlags) {
- if (this.statsDisabled) {
- return new DummyStatisticsImpl(type, textId, numericId);
- }
- statsListUniqueId.increment();
- Statistics result =
- new LocalStatisticsImpl(type, textId, numericId,
statsListUniqueId.longValue(), false, osStatFlags, this);
- synchronized (statsList) {
- statsList.add(result);
- statsListModCount++;
- }
- return result;
- }
-
public Statistics[] findStatisticsByType(final StatisticsType type) {
final ArrayList<Statistics> hits = new ArrayList<>();
visitStatistics(vistorStatistic -> {
@@ -207,17 +227,7 @@ public class InternalDistributedSystemStats
}
public Statistics createAtomicStatistics(StatisticsType type, String textId,
long numericId) {
- if (this.statsDisabled) {
- return new DummyStatisticsImpl(type, textId, numericId);
- }
-
- statsListUniqueId.increment();
- Statistics result = StatisticsImpl.createAtomicNoOS(type, textId,
numericId,statsListUniqueId.longValue(), this);
- synchronized (statsList) {
- statsList.add(result);
- statsListModCount++;
- }
- return result;
+ return statisticsTypeFactory.createAtomicStatistics(type, textId,
numericId);
}
/**
@@ -239,6 +249,22 @@ public class InternalDistributedSystemStats
}
@Override
+ public Statistics createOsStatistics(StatisticsType type, String textId,
long numericId, int osStatFlags) {
+ if (this.statsDisabled) {
+ return new DummyStatisticsImpl(type, textId, numericId);
+ }
+ statsListUniqueId.increment();
+ Statistics result =
+ new LocalStatisticsImpl(type, textId, numericId,
statsListUniqueId.longValue(), false,
+ osStatFlags, this);
+ synchronized (statsList) {
+ statsList.add(result);
+ statsListModCount++;
+ }
+ return result;
+ }
+
+ @Override
public StatisticDescriptor createIntCounter(String name, String description,
String units) {
return statisticsTypeFactory.createIntCounter(name, description, units);
}
@@ -346,7 +372,9 @@ public class InternalDistributedSystemStats
functionstats.close();
}
- this.sampler.stop();
+ if (sampler != null) {
+ this.sampler.stop();
+ }
}
public GemFireStatSampler getStatSampler() {
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/statistics/LocalStatisticsFactory.java
b/geode-core/src/main/java/org/apache/geode/internal/statistics/LocalStatisticsFactory.java
index d8264ea..60fe601 100644
---
a/geode-core/src/main/java/org/apache/geode/internal/statistics/LocalStatisticsFactory.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/statistics/LocalStatisticsFactory.java
@@ -81,8 +81,8 @@ public class LocalStatisticsFactory extends
AbstractStatisticsFactory
}
@Override
- protected Statistics createOsStatistics(StatisticsType type, String textId,
long numericId,
- int osStatFlags) {
+ public Statistics createOsStatistics(StatisticsType type, String textId,
long numericId,
+ int osStatFlags) {
if (this.statsDisabled) {
return new DummyStatisticsImpl(type, textId, numericId);
}
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/statistics/LocalStatisticsImpl.java
b/geode-core/src/main/java/org/apache/geode/internal/statistics/LocalStatisticsImpl.java
index 08bbc13..233f78f 100644
---
a/geode-core/src/main/java/org/apache/geode/internal/statistics/LocalStatisticsImpl.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/statistics/LocalStatisticsImpl.java
@@ -79,7 +79,7 @@ public class LocalStatisticsImpl extends StatisticsImpl {
this.dSystem = system;
- StatisticsTypeImpl realType = (StatisticsTypeImpl) type;
+ StatisticsType realType = type;
int intCount = realType.getIntStatCount();
int longCount = realType.getLongStatCount();
int doubleCount = realType.getDoubleStatCount();
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/statistics/StatisticsImpl.java
b/geode-core/src/main/java/org/apache/geode/internal/statistics/StatisticsImpl.java
index 6e0b005..627e66d 100644
---
a/geode-core/src/main/java/org/apache/geode/internal/statistics/StatisticsImpl.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/statistics/StatisticsImpl.java
@@ -53,7 +53,7 @@ public abstract class StatisticsImpl implements Statistics {
static Logger logger = LogService.getLogger();
/** The type of this statistics instance */
- private final StatisticsTypeImpl type;
+ private final StatisticsType type;
/** The display name of this statistics instance */
private final String textId;
@@ -113,7 +113,7 @@ public abstract class StatisticsImpl implements Statistics {
*/
public StatisticsImpl(StatisticsType type, String textId, long numericId,
long uniqueId,
int osStatFlags) {
- this.type = (StatisticsTypeImpl) type;
+ this.type = type;
this.textId = textId;
this.numericId = numericId;
this.uniqueId = uniqueId;
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/statistics/StatisticsTypeImpl.java
b/geode-core/src/main/java/org/apache/geode/internal/statistics/StatisticsTypeImpl.java
index 4dbdd0d..bc6b437 100644
---
a/geode-core/src/main/java/org/apache/geode/internal/statistics/StatisticsTypeImpl.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/statistics/StatisticsTypeImpl.java
@@ -187,6 +187,7 @@ public class StatisticsTypeImpl implements StatisticsType {
/**
* Gets the number of statistics in this type that are ints.
*/
+ @Override
public int getIntStatCount() {
return this.intStatCount;
}
@@ -194,6 +195,7 @@ public class StatisticsTypeImpl implements StatisticsType {
/**
* Gets the number of statistics in this type that are longs.
*/
+ @Override
public int getLongStatCount() {
return this.longStatCount;
}
@@ -201,6 +203,7 @@ public class StatisticsTypeImpl implements StatisticsType {
/**
* Gets the number of statistics that are doubles.
*/
+ @Override
public int getDoubleStatCount() {
return this.doubleStatCount;
}
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/stats50/Atomic50StatisticsImpl.java
b/geode-core/src/main/java/org/apache/geode/internal/stats50/Atomic50StatisticsImpl.java
index cd608cc..59169e5 100644
---
a/geode-core/src/main/java/org/apache/geode/internal/stats50/Atomic50StatisticsImpl.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/stats50/Atomic50StatisticsImpl.java
@@ -26,7 +26,6 @@ import org.apache.geode.internal.OSProcess;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.statistics.StatisticsImpl;
import org.apache.geode.internal.statistics.StatisticsManager;
-import org.apache.geode.internal.statistics.StatisticsTypeImpl;
/**
* An implementation of {@link Statistics} that stores its statistics in local
java memory.
@@ -69,7 +68,7 @@ public class Atomic50StatisticsImpl extends StatisticsImpl {
super(type, calcTextId(system, textId), calcNumericId(system, numericId),
uniqueId, 0);
this.dSystem = system;
- StatisticsTypeImpl realType = (StatisticsTypeImpl) type;
+ StatisticsType realType = type;
if (realType.getDoubleStatCount() > 0) {
throw new IllegalArgumentException(
LocalizedStrings.Atomic50StatisticsImpl_ATOMICS_DO_NOT_SUPPORT_DOUBLE_STATS
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/LocalManager.java
b/geode-core/src/main/java/org/apache/geode/management/internal/LocalManager.java
index 8bdec89..e0f6088 100644
---
a/geode-core/src/main/java/org/apache/geode/management/internal/LocalManager.java
+++
b/geode-core/src/main/java/org/apache/geode/management/internal/LocalManager.java
@@ -174,13 +174,7 @@ public class LocalManager extends Manager {
monitoringRegionAttrs, internalArgs));
monitoringRegionCreated = true;
- } catch (TimeoutException e) {
- throw new ManagementException(e);
- } catch (RegionExistsException e) {
- throw new ManagementException(e);
- } catch (IOException e) {
- throw new ManagementException(e);
- } catch (ClassNotFoundException e) {
+ } catch (TimeoutException | RegionExistsException | IOException |
ClassNotFoundException e) {
throw new ManagementException(e);
}
@@ -189,13 +183,7 @@ public class LocalManager extends Manager {
cache.createVMRegion(ManagementConstants.NOTIFICATION_REGION +
"_" + appender,
notifRegionAttrs, internalArgs));
notifRegionCreated = true;
- } catch (TimeoutException e) {
- throw new ManagementException(e);
- } catch (RegionExistsException e) {
- throw new ManagementException(e);
- } catch (IOException e) {
- throw new ManagementException(e);
- } catch (ClassNotFoundException e) {
+ } catch (TimeoutException | ClassNotFoundException | IOException |
RegionExistsException e) {
throw new ManagementException(e);
} finally {
if (!notifRegionCreated && monitoringRegionCreated) {
diff --git a/geode-core/src/main/kotlin/Locator.kt
b/geode-core/src/main/kotlin/Locator.kt
new file mode 100644
index 0000000..d1da1ff
--- /dev/null
+++ b/geode-core/src/main/kotlin/Locator.kt
@@ -0,0 +1,19 @@
+import org.apache.geode.distributed.ConfigurationProperties
+import org.apache.geode.distributed.LocatorLauncher
+
+fun main(args: Array<String>) {
+ val build = LocatorLauncher.Builder().apply {
+ port = 44550
+ set("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)
+ }
+}
\ No newline at end of file
diff --git a/geode-core/src/main/kotlin/Server.kt
b/geode-core/src/main/kotlin/Server.kt
new file mode 100644
index 0000000..6ee811c
--- /dev/null
+++ b/geode-core/src/main/kotlin/Server.kt
@@ -0,0 +1,33 @@
+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.*
+import java.util.stream.IntStream
+
+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()
+
+ val diskStoreFactory = cache.createDiskStoreFactory()
+ diskStoreFactory.setDiskDirs(arrayOf(File("/tmp")))
+ diskStoreFactory.create("someDiskStore")
+
+ val regionFactory = cache.createRegionFactory<String,
String>(RegionShortcut.PARTITION_REDUNDANT_OVERFLOW)
+ regionFactory.setStatisticsEnabled(true)
+ regionFactory.setDiskStoreName("someDiskStore")
+ val region1 = regionFactory.create("Region1")
+
+ IntStream.range(0, Int.MAX_VALUE).forEach {
+ region1[it.toString()] = region1.size.toString()
+ Thread.sleep(600)
+ println("Processed value $it")
+ }
+}
\ No newline at end of file
diff --git
a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java
index f13cbca..3e34804 100644
---
a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java
+++
b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java
@@ -53,6 +53,8 @@ import org.apache.geode.internal.Version;
import org.apache.geode.internal.admin.remote.RemoteTransportConfig;
import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.security.SecurityServiceFactory;
+import org.apache.geode.internal.statistics.StatisticsTypeFactoryImpl;
+import org.apache.geode.statistics.StatisticsFactory;
import org.apache.geode.test.junit.categories.IntegrationTest;
import org.apache.geode.test.junit.categories.MembershipTest;
@@ -68,7 +70,8 @@ public class GMSLocatorRecoveryJUnitTest {
if (this.tempStateFile.exists()) {
this.tempStateFile.delete();
}
- this.locator = new GMSLocator(null, null, false, false, new
LocatorStats(), "");
+ this.locator = new GMSLocator(null, null, false, false, new LocatorStats(
+ (StatisticsFactory) new StatisticsTypeFactoryImpl()), "");
locator.setViewFile(tempStateFile);
// System.out.println("temp state file: " + tempStateFile);
}
@@ -178,7 +181,8 @@ public class GMSLocatorRecoveryJUnitTest {
((InternalLocator) l).getLocatorHandler().setMembershipManager(m1);
GMSLocator l2 = new GMSLocator(SocketCreator.getLocalHost(),
- m1.getLocalMember().getHost() + "[" + port + "]", true, true, new
LocatorStats(), "");
+ m1.getLocalMember().getHost() + "[" + port + "]", true, true, new
LocatorStats(
+ (StatisticsFactory) new StatisticsTypeFactoryImpl()), "");
l2.setViewFile(new File("l2.dat"));
l2.init(null);
diff --git
a/geode-core/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelQueueRemovalMessageJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelQueueRemovalMessageJUnitTest.java
index 4db64c5..ac9c542 100644
---
a/geode-core/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelQueueRemovalMessageJUnitTest.java
+++
b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelQueueRemovalMessageJUnitTest.java
@@ -67,6 +67,8 @@ import
org.apache.geode.internal.cache.wan.AbstractGatewaySender;
import org.apache.geode.internal.cache.wan.GatewaySenderEventImpl;
import org.apache.geode.internal.cache.wan.GatewaySenderStats;
import org.apache.geode.internal.statistics.DummyStatisticsFactory;
+import org.apache.geode.internal.statistics.StatisticsTypeFactoryImpl;
+import org.apache.geode.statistics.StatisticsFactory;
import org.apache.geode.test.fake.Fakes;
import org.apache.geode.test.junit.categories.UnitTest;
@@ -119,7 +121,8 @@ public class ParallelQueueRemovalMessageJUnitTest {
when(this.queueRegion.getParallelGatewaySender()).thenReturn(this.sender);
when(this.sender.getQueues()).thenReturn(null);
when(this.sender.getDispatcherThreads()).thenReturn(1);
- stats = new GatewaySenderStats(new DummyStatisticsFactory(), "ln");
+ stats = new GatewaySenderStats(new DummyStatisticsFactory(
+ (StatisticsFactory) new StatisticsTypeFactoryImpl()), "ln");
when(this.sender.getStatistics()).thenReturn(stats);
}
diff --git
a/geode-core/src/test/java/org/apache/geode/internal/statistics/DiskSpaceLimitIntegrationTest.java
b/geode-core/src/test/java/org/apache/geode/internal/statistics/DiskSpaceLimitIntegrationTest.java
index 46fd647..87aa25f 100644
---
a/geode-core/src/test/java/org/apache/geode/internal/statistics/DiskSpaceLimitIntegrationTest.java
+++
b/geode-core/src/test/java/org/apache/geode/internal/statistics/DiskSpaceLimitIntegrationTest.java
@@ -130,7 +130,6 @@ public class DiskSpaceLimitIntegrationTest {
@After
public void tearDown() throws Exception {
- StatisticsTypeFactoryImpl.clear();
}
@Test
diff --git
a/geode-core/src/test/java/org/apache/geode/internal/statistics/FileSizeLimitIntegrationTest.java
b/geode-core/src/test/java/org/apache/geode/internal/statistics/FileSizeLimitIntegrationTest.java
index 9e1ae05..43653a7 100644
---
a/geode-core/src/test/java/org/apache/geode/internal/statistics/FileSizeLimitIntegrationTest.java
+++
b/geode-core/src/test/java/org/apache/geode/internal/statistics/FileSizeLimitIntegrationTest.java
@@ -112,7 +112,6 @@ public class FileSizeLimitIntegrationTest {
@After
public void tearDown() throws Exception {
- StatisticsTypeFactoryImpl.clear();
}
@Test
diff --git
a/geode-core/src/test/java/org/apache/geode/internal/statistics/LinuxSystemStatsTest.java
b/geode-core/src/test/java/org/apache/geode/internal/statistics/LinuxSystemStatsTest.java
index 9388f1a..78ce311 100644
---
a/geode-core/src/test/java/org/apache/geode/internal/statistics/LinuxSystemStatsTest.java
+++
b/geode-core/src/test/java/org/apache/geode/internal/statistics/LinuxSystemStatsTest.java
@@ -45,6 +45,7 @@ import org.apache.geode.CancelCriterion;
import org.apache.geode.statistics.Statistics;
import org.apache.geode.internal.statistics.platform.LinuxProcFsStatistics;
import org.apache.geode.internal.statistics.platform.LinuxSystemStats;
+import org.apache.geode.statistics.StatisticsFactory;
import org.apache.geode.test.junit.categories.IntegrationTest;
import org.apache.geode.test.junit.categories.StatisticsTest;
@@ -78,7 +79,8 @@ public class LinuxSystemStatsTest extends StatSamplerTestCase
{
+ File.separator + SimpleStatSampler.DEFAULT_ARCHIVE_FILE_NAME);
LinuxProcFsStatistics.init();
initStats();
- StatisticsTypeImpl statisticsType = (StatisticsTypeImpl)
LinuxSystemStats.getType();
+ StatisticsTypeImpl statisticsType = (StatisticsTypeImpl) new
LinuxSystemStats(
+ (StatisticsFactory) new StatisticsTypeFactoryImpl()).getType();
LocalStatisticsImpl statistics = (LocalStatisticsImpl)
getStatisticsManager()
.createStatistics(statisticsType, statisticsType.getName());
@@ -89,7 +91,6 @@ public class LinuxSystemStatsTest extends StatSamplerTestCase
{
@After
public void tearDown() throws Exception {
- StatisticsTypeFactoryImpl.clear();
if (this.statisticsFactory != null) {
this.statisticsFactory.close();
}
diff --git
a/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWithConsecutiveResourceInstGenerator.java
b/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWithConsecutiveResourceInstGenerator.java
index 0e51169..a420422 100644
---
a/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWithConsecutiveResourceInstGenerator.java
+++
b/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWithConsecutiveResourceInstGenerator.java
@@ -101,7 +101,7 @@ public class
StatArchiveWithConsecutiveResourceInstGenerator {
@After
public void tearDown() throws Exception {
- StatisticsTypeFactoryImpl.clear();
+// StatisticsTypeFactoryImpl.clear();
}
@Test
diff --git
a/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWithMissingResourceTypeRegressionTest.java
b/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWithMissingResourceTypeRegressionTest.java
index 9be3408..ac1c6d0 100644
---
a/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWithMissingResourceTypeRegressionTest.java
+++
b/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWithMissingResourceTypeRegressionTest.java
@@ -66,7 +66,6 @@ public class StatArchiveWithMissingResourceTypeRegressionTest
{
@After
public void tearDown() throws Exception {
- StatisticsTypeFactoryImpl.clear();
}
@Test
diff --git
a/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWriterReaderIntegrationTest.java
b/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWriterReaderIntegrationTest.java
index e3cb432..fb76b1c 100755
---
a/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWriterReaderIntegrationTest.java
+++
b/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWriterReaderIntegrationTest.java
@@ -92,7 +92,6 @@ public class StatArchiveWriterReaderIntegrationTest {
public void tearDown() throws Exception {
this.statisticTypes = null;
this.allStatistics = null;
- StatisticsTypeFactoryImpl.clear();
}
@Test
@@ -1599,6 +1598,21 @@ public class StatArchiveWriterReaderIntegrationTest {
public StatisticDescriptor nameToDescriptor(String name) {
return null;
}
+
+ @Override
+ public int getIntStatCount() {
+ return 0;
+ }
+
+ @Override
+ public int getLongStatCount() {
+ return 0;
+ }
+
+ @Override
+ public int getDoubleStatCount() {
+ return 0;
+ }
};
}
diff --git
a/geode-core/src/test/java/org/apache/geode/internal/statistics/StatSamplerIntegrationTest.java
b/geode-core/src/test/java/org/apache/geode/internal/statistics/StatSamplerIntegrationTest.java
index 54062e0..9ec8c1d 100755
---
a/geode-core/src/test/java/org/apache/geode/internal/statistics/StatSamplerIntegrationTest.java
+++
b/geode-core/src/test/java/org/apache/geode/internal/statistics/StatSamplerIntegrationTest.java
@@ -78,7 +78,6 @@ public class StatSamplerIntegrationTest {
public void tearDown() {
this.statisticTypes = null;
this.allStatistics = null;
- StatisticsTypeFactoryImpl.clear();
StatArchiveWriter.clearTraceFilter();
}
diff --git
a/geode-core/src/test/java/org/apache/geode/internal/statistics/StatTypesAreRolledOverRegressionTest.java
b/geode-core/src/test/java/org/apache/geode/internal/statistics/StatTypesAreRolledOverRegressionTest.java
index 0ae515d..e3bbc2a 100644
---
a/geode-core/src/test/java/org/apache/geode/internal/statistics/StatTypesAreRolledOverRegressionTest.java
+++
b/geode-core/src/test/java/org/apache/geode/internal/statistics/StatTypesAreRolledOverRegressionTest.java
@@ -106,7 +106,6 @@ public class StatTypesAreRolledOverRegressionTest {
@After
public void tearDown() throws Exception {
- StatisticsTypeFactoryImpl.clear();
}
@Test
diff --git
a/geode-core/src/test/java/org/apache/geode/internal/statistics/StatisticsDistributedTest.java
b/geode-core/src/test/java/org/apache/geode/internal/statistics/StatisticsDistributedTest.java
index 4e9d4af..fd73c85 100755
---
a/geode-core/src/test/java/org/apache/geode/internal/statistics/StatisticsDistributedTest.java
+++
b/geode-core/src/test/java/org/apache/geode/internal/statistics/StatisticsDistributedTest.java
@@ -569,7 +569,7 @@ public class StatisticsDistributedTest extends
JUnit4CacheTestCase {
private static final String UPDATE_EVENTS = "updateEvents";
private static StatisticsType createType(final StatisticsFactory f) {
- StatisticsTypeFactory stf = StatisticsTypeFactoryImpl.singleton();
+ StatisticsTypeFactory stf = new StatisticsTypeFactoryImpl();
StatisticsType type = stf.createType(TYPE_NAME, TYPE_DESCRIPTION,
createDescriptors(f));
return type;
}
diff --git
a/geode-core/src/test/java/org/apache/geode/internal/statistics/TestStatisticsManager.java
b/geode-core/src/test/java/org/apache/geode/internal/statistics/TestStatisticsManager.java
index 2198462..26557d6 100755
---
a/geode-core/src/test/java/org/apache/geode/internal/statistics/TestStatisticsManager.java
+++
b/geode-core/src/test/java/org/apache/geode/internal/statistics/TestStatisticsManager.java
@@ -15,6 +15,7 @@
package org.apache.geode.internal.statistics;
import org.apache.geode.statistics.Statistics;
+import org.apache.geode.statistics.StatisticsFactory;
import org.apache.geode.statistics.StatisticsType;
import org.apache.geode.internal.statistics.platform.OsStatisticsFactory;
@@ -25,7 +26,7 @@ public class TestStatisticsManager extends
AbstractStatisticsFactory
implements StatisticsManager, OsStatisticsFactory {
public TestStatisticsManager(final long id, final String name, final long
startTime) {
- super(id, name, startTime);
+ super((StatisticsFactory) new StatisticsTypeFactoryImpl(),id, name,
startTime);
}
@Override
diff --git
a/geode-core/src/test/java/org/apache/geode/internal/stats50/AtomicStatsJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/internal/stats50/AtomicStatsJUnitTest.java
index a5b3744..4e7adfc 100644
---
a/geode-core/src/test/java/org/apache/geode/internal/stats50/AtomicStatsJUnitTest.java
+++
b/geode-core/src/test/java/org/apache/geode/internal/stats50/AtomicStatsJUnitTest.java
@@ -56,7 +56,7 @@ public class AtomicStatsJUnitTest {
final String statDesc = "blah blah blah";
- StatisticsTypeFactory f = StatisticsTypeFactoryImpl.singleton();
+ StatisticsTypeFactory f = new StatisticsTypeFactoryImpl();
StatisticsType type = f.createType(statName, statDescription, new
StatisticDescriptor[] {
f.createIntGauge("stat", statDesc, "bottles of beer on the wall"),});
diff --git
a/geode-core/src/test/java/org/apache/geode/management/bean/stats/AsyncEventQueueStatsJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/bean/stats/AsyncEventQueueStatsJUnitTest.java
index 85ddc78..27dabd1 100644
---
a/geode-core/src/test/java/org/apache/geode/management/bean/stats/AsyncEventQueueStatsJUnitTest.java
+++
b/geode-core/src/test/java/org/apache/geode/management/bean/stats/AsyncEventQueueStatsJUnitTest.java
@@ -58,7 +58,7 @@ public class AsyncEventQueueStatsJUnitTest extends
MBeanStatsTestCase {
@Test
public void testStatDescriptors() {
- StatisticDescriptor[] sds = asyncEventQueueStats.type.getStatistics();
+ StatisticDescriptor[] sds = asyncEventQueueStats.getType().getStatistics();
int notQueueEvents = 0;
int notQueueToPrimary = 0;
int eventsProcessedByPQRM = 0;
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/internal/micrometer/StatisticsManager.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/internal/micrometer/StatisticsManager.kt
index ffe6217..c03eb27 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/internal/micrometer/StatisticsManager.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/internal/micrometer/StatisticsManager.kt
@@ -1,5 +1,8 @@
package org.apache.geode.statistics.internal.micrometer
+import io.micrometer.core.instrument.MeterRegistry
+
interface StatisticsManager {
fun registerMeterGroup(groupName:String, meterGroup: StatisticsMeterGroup)
+ fun registerMeterRegistry(meterRegistry: MeterRegistry)
}
\ No newline at end of file
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/internal/micrometer/impl/MicrometerStatisticMeter.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/internal/micrometer/impl/MicrometerStatisticMeter.kt
index 4ce9c05..cb79aff 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/internal/micrometer/impl/MicrometerStatisticMeter.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/internal/micrometer/impl/MicrometerStatisticMeter.kt
@@ -58,9 +58,7 @@ abstract class MicrometerStatisticMeter(
setValue(value.toLong())
}
- open fun setValue(value: Long) {
- TODO("not implemented") //To change body of created functions use File
| Settings | File Templates.
- }
+ abstract fun setValue(value: Long)
abstract fun getValue(): Long
@@ -182,13 +180,16 @@ data class CounterStatisticMeter(val meterName: String,
override fun equals(other: Any?) = super.equals(other)
override fun getValue(): Long = meter.count().toLong()
+
+ override fun setValue(value: Long) {
+ meter.increment(value.toDouble())
+ }
}
data class TimerStatisticMeter(val meterName: String,
val meterDescription: String,
val meterTags: Array<String> = emptyArray(),
val meterUnit: String = "") :
TimedStatisticsMeter, MicrometerStatisticMeter(meterName, meterDescription,
meterUnit) {
-
private lateinit var meter: Timer
override fun register(meterRegistry: MeterRegistry, tags: Iterable<Tag>) {
@@ -210,4 +211,8 @@ data class TimerStatisticMeter(val meterName: String,
override fun getValue(): Long {
TODO("A timer meter should not be exposing its metrics outside of
itself")
}
+
+ override fun setValue(value: Long) {
+ TODO("not implemented") //To change body of created functions use File
| Settings | File Templates.
+ }
}
\ No newline at end of file
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 dd56b27..279ef67 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
@@ -2,6 +2,7 @@ package org.apache.geode.statistics.internal.micrometer.impl
import io.micrometer.core.instrument.Clock
import io.micrometer.core.instrument.Meter
+import io.micrometer.core.instrument.MeterRegistry
import io.micrometer.core.instrument.composite.CompositeMeterRegistry
import io.micrometer.core.instrument.config.MeterFilter
import io.micrometer.core.instrument.config.MeterFilterReply
@@ -12,15 +13,20 @@ import java.net.InetAddress
class MicrometerStatisticsManager @JvmOverloads constructor(private val
enableStats: Boolean = true,
private val
serverName: String = "cacheServer" + InetAddress.getLocalHost().hostAddress,
+ vararg
meterRegistries: MeterRegistry,
private val
meterRegistry: CompositeMeterRegistry =
CompositeMeterRegistry(Clock.SYSTEM)) : StatisticsManager {
private val registeredMeterGroups = mutableMapOf<String,
MicrometerMeterGroup>()
init {
- meterRegistry.add(SimpleMeterRegistry())
+ meterRegistries.forEach { meterRegistry.add(it) }
meterRegistry.config().commonTags("serverName", serverName)
}
+ override fun registerMeterRegistry(meterRegistry: MeterRegistry) {
+ this.meterRegistry.add(meterRegistry)
+ }
+
override fun registerMeterGroup(groupName: String, meterGroup:
StatisticsMeterGroup) {
if (meterGroup is MicrometerMeterGroup) {
registeredMeterGroups.putIfAbsent(groupName, meterGroup)
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 630c548..ff6a256 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
@@ -1,5 +1,7 @@
package org.apache.geode.statistics.micrometer
+import io.micrometer.core.instrument.MeterRegistry
+import io.micrometer.core.instrument.simple.SimpleMeterRegistry
import org.apache.geode.statistics.StatisticDescriptor
import org.apache.geode.statistics.Statistics
import org.apache.geode.statistics.StatisticsFactory
@@ -9,10 +11,14 @@ import
org.apache.geode.statistics.internal.micrometer.impl.GaugeStatisticMeter
import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerStatisticsManager
import java.io.Reader
-class MicrometerStatisticsFactoryImpl : StatisticsFactory {
- private val micrometerStatisticsManager = MicrometerStatisticsManager()
+class MicrometerStatisticsFactoryImpl(vararg meterRegistries: MeterRegistry=
arrayOf(SimpleMeterRegistry())) : StatisticsFactory {
+
+ private val micrometerStatisticsManager =
MicrometerStatisticsManager(meterRegistries = *meterRegistries)
private val meterGroupMap = hashMapOf<String, StatisticsType>()
+ override fun createOsStatistics(type: StatisticsType?, textId: String,
numericId: Long, osStatFlags: Int): Statistics =
+ MicrometerStatisticsImpl(0,type as
MicrometerStatisticsType,textId,numericId)
+
override fun createStatistics(type: StatisticsType): Statistics {
TODO("not implemented") //To change body of created functions use File
| Settings | File Templates.
}
@@ -33,9 +39,8 @@ class MicrometerStatisticsFactoryImpl : StatisticsFactory {
TODO("not implemented") //To change body of created functions use File
| Settings | File Templates.
}
- override fun createAtomicStatistics(type: StatisticsType, textId: String,
numericId: Long): Statistics {
- TODO("not implemented") //To change body of created functions use File
| Settings | File Templates.
- }
+ override fun createAtomicStatistics(type: StatisticsType, textId: String,
numericId: Long): Statistics =
+ MicrometerStatisticsImpl(0,type as
MicrometerStatisticsType,textId,numericId)
override fun findStatisticsByType(type: StatisticsType): Array<Statistics>
{
TODO("not implemented") //To change body of created functions use File
| Settings | File Templates.
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/micrometer/MicrometerStatisticsType.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/micrometer/MicrometerStatisticsType.kt
index 5800890..1505f4b 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/micrometer/MicrometerStatisticsType.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/micrometer/MicrometerStatisticsType.kt
@@ -34,5 +34,9 @@ class MicrometerStatisticsType(private val name: String,
override fun nameToDescriptor(name: String): StatisticDescriptor =
statsArray[nameToId(name)]
+ override fun getIntStatCount(): Int = 0
+ override fun getLongStatCount(): Int = 0
+ override fun getDoubleStatCount(): Int = 0
+
fun getStatsForId(id: Int) = statsArray[id] as MicrometerStatisticMeter
}
\ No newline at end of file
diff --git
a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/protobuf/v1/ProtobufProtocolServiceJUnitTest.java
b/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/protobuf/v1/ProtobufProtocolServiceJUnitTest.java
deleted file mode 100644
index aa62647..0000000
---
a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/protobuf/v1/ProtobufProtocolServiceJUnitTest.java
+++ /dev/null
@@ -1,38 +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.geode.internal.protocol.protobuf.v1;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.internal.protocol.protobuf.statistics.ClientStatistics;
-import org.apache.geode.internal.statistics.DummyStatisticsFactory;
-import org.apache.geode.test.junit.categories.ClientServerTest;
-import org.apache.geode.test.junit.categories.UnitTest;
-
-@Category({UnitTest.class, ClientServerTest.class})
-public class ProtobufProtocolServiceJUnitTest {
- @Test
- public void initializeStatistics() {
- ProtobufProtocolService service = new ProtobufProtocolService();
- service.initializeStatistics("first", new DummyStatisticsFactory());
- ClientStatistics firstStatistics = service.getStatistics();
- service.initializeStatistics("second", new DummyStatisticsFactory());
- ClientStatistics secondStatistics = service.getStatistics();
- assertEquals(firstStatistics, secondStatistics);
- }
-}
diff --git
a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/AsyncEventQueueOverflowMBeanAttributesDistributedTest.java
b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/AsyncEventQueueOverflowMBeanAttributesDistributedTest.java
index de88f0b..98457e5 100644
---
a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/AsyncEventQueueOverflowMBeanAttributesDistributedTest.java
+++
b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/AsyncEventQueueOverflowMBeanAttributesDistributedTest.java
@@ -204,9 +204,9 @@ public class
AsyncEventQueueOverflowMBeanAttributesDistributedTest extends Async
private void waitForSamplerToSample(int numTimesToSample) throws Exception {
InternalDistributedSystem ids = (InternalDistributedSystem)
cache.getDistributedSystem();
- assertThat(ids.getStatSampler().waitForSampleCollector(60000)).isNotNull();
+
assertThat(ids.getInternalDistributedSystemStats().getStatSampler().waitForSampleCollector(60000)).isNotNull();
for (int i = 0; i < numTimesToSample; i++) {
- assertThat(ids.getStatSampler().waitForSample((60000))).isTrue();
+
assertThat(ids.getInternalDistributedSystemStats().getStatSampler().waitForSample((60000))).isTrue();
}
}
diff --git
a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewaySenderOverflowMBeanAttributesDistributedTest.java
b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewaySenderOverflowMBeanAttributesDistributedTest.java
index 7e03daf..64853ca 100644
---
a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewaySenderOverflowMBeanAttributesDistributedTest.java
+++
b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewaySenderOverflowMBeanAttributesDistributedTest.java
@@ -213,9 +213,9 @@ public class
GatewaySenderOverflowMBeanAttributesDistributedTest extends WANTest
private void waitForSamplerToSample(int numTimesToSample) throws Exception {
InternalDistributedSystem ids = (InternalDistributedSystem)
cache.getDistributedSystem();
- assertThat(ids.getStatSampler().waitForSampleCollector(60000)).isNotNull();
+
assertThat(ids.getInternalDistributedSystemStats().getStatSampler().waitForSampleCollector(60000)).isNotNull();
for (int i = 0; i < numTimesToSample; i++) {
- assertThat(ids.getStatSampler().waitForSample((60000))).isTrue();
+
assertThat(ids.getInternalDistributedSystemStats().getStatSampler().waitForSample((60000))).isTrue();
}
}
}