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 576079a More clean up. Hopefully cleaner implementation
576079a is described below
commit 576079a647e8e4eb975afed330d203f7fdb92bbc
Author: Udo Kohlmeyer <[email protected]>
AuthorDate: Wed Sep 12 14:59:05 2018 -0700
More clean up. Hopefully cleaner implementation
---
.../execute/FunctionServiceStatsDUnitTest.java | 22 +-
.../bean/stats/MemberLevelStatsJUnitTest.java | 7 +-
.../internal/DistributionStatsImpl.java | 4 +-
.../internal/InternalDistributedSystem.java | 3 +-
.../distributed/internal/InternalLocator.java | 3 +-
.../distributed/internal/LocatorStatsImpl.java | 18 +-
.../distributed/internal/locks/DLockStatsImpl.java | 9 +-
.../geode/internal/cache/CachePerfStatsImpl.java | 289 ++++++++++-----------
.../geode/internal/cache/DiskStoreStatsImpl.java | 62 ++---
.../geode/internal/cache/RegionPerfStatsImpl.java | 2 +-
...iceStats.java => FunctionServiceStatsImpl.java} | 27 +-
.../cache/tier/sockets/CacheServerStatsImpl.java | 4 +-
.../statistics/GFSStatisticsFactoryImpl.java | 4 +-
.../statistics/InternalDistributedSystemStats.java | 45 ++--
.../internal/statistics/SimpleStatSampler.java | 28 +-
.../internal/statistics/StatSamplerStatsImpl.java | 4 +-
.../internal/beans/MemberMBeanBridge.java | 1 +
...geode.stats.common.statistics.StatisticsFactory | 2 +-
.../internal/filesystem/FileSystemStats.java | 1 +
.../statistics/cache/MicrometerCCUStatsImpl.kt | 2 +-
.../cache/MicrometerCacheClientNotifierStats.kt | 2 +-
.../cache/MicrometerCacheClientProxyStats.kt | 2 +-
.../statistics/cache/MicrometerCachePerfStats.kt | 2 +-
.../statistics/cache/MicrometerCacheServerStats.kt | 2 +-
.../client/connection/MicrometerClientSendStats.kt | 2 +-
.../client/connection/MicrometerClientStats.kt | 2 +-
.../client/connection/MicrometerConnectionStats.kt | 4 +-
.../client/connection/MicrometerPoolStats.kt | 2 +-
.../disk/MicrometerDiskDirectoryStats.kt | 2 +-
.../statistics/disk/MicrometerDiskRegionStats.kt | 2 +-
.../statistics/disk/MicrometerDiskStoreStats.kt | 2 +-
.../distributed/MicrometerDistributionStats.kt | 2 +-
.../geode/statistics/dlock/MicrometerDLockStats.kt | 2 +-
.../eviction/MicrometerCountLRUStatistics.kt | 2 +-
.../eviction/MicrometerEvictionStatsImpl.kt | 2 +-
.../eviction/MicrometerHeapLRUStatistics.kt | 2 +-
.../eviction/MicrometerMemoryLRUStatistics.kt | 2 +-
.../function/MicrometerFunctionServiceStats.kt | 80 ++++++
.../statistics/function/MicrometerFunctionStats.kt | 5 +-
.../micrometer/impl/MicrometerMeterGroup.kt | 16 +-
.../micrometer/impl/MicrometerStatisticsManager.kt | 16 +-
.../statistics/locator/MicrometerLocatorStats.kt | 4 +-
.../micrometer/MicrometerStatisticsFactoryImpl.kt | 11 +-
.../micrometer/MicrometerStatisticsType.kt | 13 +-
.../offheap/MicrometerOffHeapStorageStats.kt | 2 +-
.../statistics/query/MicrometerCqQueryVsdStats.kt | 2 +-
.../query/MicrometerCqServiceVsdStats.kt | 6 +-
.../region/MicrometerHARegionQueueStats.kt | 2 +-
.../region/MicrometerPartitionedRegionStats.kt | 2 +-
.../statistics/region/MicrometerRegionPerfStats.kt | 2 +-
.../MicrometerResourceManagerStats.kt | 14 +-
.../wan/MicrometerAsyncEventQueueStats.kt | 2 +-
.../wan/MicrometerGatewayReceiverStats.kt | 2 +-
.../statistics/wan/MicrometerGatewaySenderStats.kt | 2 +-
.../cache/execute/FunctionServiceStats.java | 64 +++++
.../common/distributed/internal/LocatorStats.java | 2 +-
.../common/statistics/GFSStatsImplementer.java | 5 +
.../stats/common/statistics/StatsImplementer.java | 2 +
.../common/statistics/factory/StatsFactory.java | 57 ++--
59 files changed, 524 insertions(+), 360 deletions(-)
diff --git
a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/FunctionServiceStatsDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/FunctionServiceStatsDUnitTest.java
index a88d434..8696716 100644
---
a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/FunctionServiceStatsDUnitTest.java
+++
b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/FunctionServiceStatsDUnitTest.java
@@ -169,7 +169,7 @@ public class FunctionServiceStatsDUnitTest extends
PRClientServerTestBase {
* functions this is true, however, at this point the function stats may not
have been updated yet
* thus any code which checks stats after calling getResult() may get wrong
data.
*/
- private void waitNoFunctionsRunning(FunctionServiceStats stats) {
+ private void waitNoFunctionsRunning(FunctionServiceStatsImpl stats) {
int count = 100;
while (stats.getFunctionExecutionsRunning() > 0 && count > 0) {
count--;
@@ -271,7 +271,7 @@ public class FunctionServiceStatsDUnitTest extends
PRClientServerTestBase {
// checks for the aggregate stats
InternalDistributedSystem internalDistributedSystem =
(InternalDistributedSystem) cache.getDistributedSystem();
- FunctionServiceStats functionServiceStats =
+ FunctionServiceStatsImpl functionServiceStats =
internalDistributedSystem.getInternalDistributedSystemStats().getFunctionServiceStats();
waitNoFunctionsRunning(functionServiceStats);
@@ -310,7 +310,7 @@ public class FunctionServiceStatsDUnitTest extends
PRClientServerTestBase {
// checks for the aggregate stats
InternalDistributedSystem internalDistributedSystem =
(InternalDistributedSystem) cache.getDistributedSystem();
- FunctionServiceStats functionServiceStats =
+ FunctionServiceStatsImpl functionServiceStats =
internalDistributedSystem.getInternalDistributedSystemStats().getFunctionServiceStats();
waitNoFunctionsRunning(functionServiceStats);
@@ -517,7 +517,7 @@ public class FunctionServiceStatsDUnitTest extends
PRClientServerTestBase {
// checks for the aggregate stats
InternalDistributedSystem internalDistributedSystem =
(InternalDistributedSystem) cache.getDistributedSystem();
- FunctionServiceStats functionServiceStats =
+ FunctionServiceStatsImpl functionServiceStats =
internalDistributedSystem.getInternalDistributedSystemStats().getFunctionServiceStats();
waitNoFunctionsRunning(functionServiceStats);
@@ -612,7 +612,7 @@ public class FunctionServiceStatsDUnitTest extends
PRClientServerTestBase {
// checks for the aggregate stats
InternalDistributedSystem internalDistributedSystem =
(InternalDistributedSystem) cache.getDistributedSystem();
- FunctionServiceStats functionServiceStats =
+ FunctionServiceStatsImpl functionServiceStats =
internalDistributedSystem.getInternalDistributedSystemStats().getFunctionServiceStats();
waitNoFunctionsRunning(functionServiceStats);
@@ -649,7 +649,7 @@ public class FunctionServiceStatsDUnitTest extends
PRClientServerTestBase {
// checks for the aggregate stats
InternalDistributedSystem internalDistributedSystem =
(InternalDistributedSystem) cache.getDistributedSystem();
- FunctionServiceStats functionServiceStats =
+ FunctionServiceStatsImpl functionServiceStats =
internalDistributedSystem.getInternalDistributedSystemStats().getFunctionServiceStats();
waitNoFunctionsRunning(functionServiceStats);
@@ -827,7 +827,7 @@ public class FunctionServiceStatsDUnitTest extends
PRClientServerTestBase {
public Object call() throws Exception {
InternalDistributedSystem internalDistributedSystem =
((InternalDistributedSystem) getCache().getDistributedSystem());
- FunctionServiceStats functionServiceStats =
+ FunctionServiceStatsImpl functionServiceStats =
internalDistributedSystem.getInternalDistributedSystemStats().getFunctionServiceStats();
waitNoFunctionsRunning(functionServiceStats);
@@ -863,7 +863,7 @@ public class FunctionServiceStatsDUnitTest extends
PRClientServerTestBase {
InternalDistributedSystem internalDistributedSystem =
((InternalDistributedSystem)
getCache().getDistributedSystem());
// 3 Function Executions took place
- FunctionServiceStats functionServiceStats =
+ FunctionServiceStatsImpl functionServiceStats =
internalDistributedSystem.getInternalDistributedSystemStats()
.getFunctionServiceStats();
waitNoFunctionsRunning(functionServiceStats);
@@ -1122,7 +1122,7 @@ public class FunctionServiceStatsDUnitTest extends
PRClientServerTestBase {
member1.invoke(new
SerializableCallable("checkFunctionExecutionStatsForMember1") {
public Object call() throws Exception {
- FunctionServiceStats functionServiceStats =
+ FunctionServiceStatsImpl functionServiceStats =
distributedSystem.getInternalDistributedSystemStats().getFunctionServiceStats();
waitNoFunctionsRunning(functionServiceStats);
@@ -1146,7 +1146,7 @@ public class FunctionServiceStatsDUnitTest extends
PRClientServerTestBase {
SerializableCallable checkFunctionExecutionStatsForOtherMember =
new SerializableCallable("checkFunctionExecutionStatsForOtherMember") {
public Object call() throws Exception {
- FunctionServiceStats functionServiceStats =
+ FunctionServiceStatsImpl functionServiceStats =
distributedSystem.getInternalDistributedSystemStats().getFunctionServiceStats();
waitNoFunctionsRunning(functionServiceStats);
@@ -1297,7 +1297,7 @@ public class FunctionServiceStatsDUnitTest extends
PRClientServerTestBase {
noOfExecutionCalls_Aggregate++;
noOfExecutionExceptions_Aggregate++;
- FunctionServiceStats functionServiceStats =
+ FunctionServiceStatsImpl functionServiceStats =
((InternalDistributedSystem) getCache().getDistributedSystem())
.getInternalDistributedSystemStats()
.getFunctionServiceStats();
diff --git
a/geode-core/src/integrationTest/java/org/apache/geode/management/bean/stats/MemberLevelStatsJUnitTest.java
b/geode-core/src/integrationTest/java/org/apache/geode/management/bean/stats/MemberLevelStatsJUnitTest.java
index aca5709..04c4c60 100644
---
a/geode-core/src/integrationTest/java/org/apache/geode/management/bean/stats/MemberLevelStatsJUnitTest.java
+++
b/geode-core/src/integrationTest/java/org/apache/geode/management/bean/stats/MemberLevelStatsJUnitTest.java
@@ -30,7 +30,7 @@ import
org.apache.geode.distributed.internal.DistributionStatsImpl;
import org.apache.geode.internal.NanoTimer;
import org.apache.geode.internal.OSProcess;
import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.cache.execute.FunctionServiceStats;
+import org.apache.geode.internal.cache.execute.FunctionServiceStatsImpl;
import org.apache.geode.internal.statistics.VMStats;
import org.apache.geode.internal.stats50.VMStats50;
import org.apache.geode.management.ManagementService;
@@ -52,7 +52,7 @@ public class MemberLevelStatsJUnitTest extends
MBeanStatsTestCase {
private CachePerfStats cachePerfStats;
- private FunctionServiceStats funcServiceStats;
+ private FunctionServiceStatsImpl funcServiceStats;
private DistributionStats distributionStats;
@@ -69,7 +69,8 @@ public class MemberLevelStatsJUnitTest extends
MBeanStatsTestCase {
public void init() {
cachePerfStats =
StatsFactory.createStatsImpl(CachePerfStats.class, null);
- funcServiceStats = new FunctionServiceStats(system.getStatisticsFactory(),
"FunctionExecution");
+ funcServiceStats =
+ new FunctionServiceStatsImpl(system.getStatisticsFactory(),
"FunctionExecution");
long statId = OSProcess.getId();
distributionStats =
StatsFactory.createStatsImpl(DistributionStats.class,
diff --git
a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionStatsImpl.java
b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionStatsImpl.java
index 0143f5d..a83182f 100644
---
a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionStatsImpl.java
+++
b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionStatsImpl.java
@@ -973,9 +973,9 @@ public class DistributionStatsImpl implements
DistributionStats, GFSStatsImpleme
* Creates a new <code>DistributionStats</code> and registers itself with
the given statistics
* factory.
*/
- public DistributionStatsImpl(StatisticsFactory factory, long statId) {
+ public DistributionStatsImpl(StatisticsFactory factory, String statId) {
initializeStats(factory);
- this.stats = factory.createAtomicStatistics(type, "distributionStats",
statId);
+ this.stats = factory.createAtomicStatistics(type, "distributionStats",
Long.parseLong(statId));
// this.replyHandoffHistogram = new HistogramStats("ReplyHandOff",
"nanoseconds", factory,
// new long[] {100000, 200000, 300000, 400000, 500000, 600000, 700000,
800000, 900000, 1000000},
// false);
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 e99bc2a..5223e44 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
@@ -612,7 +612,7 @@ public class InternalDistributedSystem extends
DistributedSystem {
private void initializeStats() {
this.internalDistributedSystemStats =
- InternalDistributedSystemStats.createInstance(this.statsDisabled,
this.getConfig(), this);
+ InternalDistributedSystemStats.createInstance(this.statsDisabled);
}
@@ -880,6 +880,7 @@ public class InternalDistributedSystem extends
DistributedSystem {
*/
private void endInitLocator() throws IOException {
InternalLocator loc = this.startedLocator;
+ getInternalDistributedSystemStats().startGemFireStatSampler(statsDisabled,
getConfig(), this);
if (loc != null) {
boolean finished = false;
try {
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 96434ae..2fdd781 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
@@ -1275,8 +1275,7 @@ public class InternalLocator extends Locator implements
ConnectListener {
@Override
public void onConnect(InternalDistributedSystem sys) {
try {
- this.stats.hookupStats(sys.getStatisticsFactory(),
- SocketCreator.getLocalHost().getCanonicalHostName() + '-' +
this.server.getBindAddress());
+
this.stats.hookupStats(SocketCreator.getLocalHost().getCanonicalHostName() +
'-' + this.server.getBindAddress());
} catch (UnknownHostException e) {
logger.warn(e);
}
diff --git
a/geode-core/src/main/java/org/apache/geode/distributed/internal/LocatorStatsImpl.java
b/geode-core/src/main/java/org/apache/geode/distributed/internal/LocatorStatsImpl.java
index 8039d3f..0407787 100755
---
a/geode-core/src/main/java/org/apache/geode/distributed/internal/LocatorStatsImpl.java
+++
b/geode-core/src/main/java/org/apache/geode/distributed/internal/LocatorStatsImpl.java
@@ -109,15 +109,15 @@ public class LocatorStatsImpl implements LocatorStats,
GFSStatsImplementer {
* Called when the DS comes online so we can hookup the stats
*/
@Override
- public void hookupStats(StatisticsFactory f, String name) {
- if (this._stats == null) {
- this._stats = f.createAtomicStatistics(type, name);
- setLocatorCount(known_locators.get());
- setServerCount(endpoints_known.get());
- setLocatorRequests(requests_to_locator.get());
- setLocatorResponses(responses_from_locator.get());
- setServerLoadUpdates(serverLoadUpdates.get());
- }
+ public void hookupStats(String name) {
+// if (this._stats == null) {
+// this._stats = f.createAtomicStatistics(type, name);
+// setLocatorCount(known_locators.get());
+// setServerCount(endpoints_known.get());
+// setLocatorRequests(requests_to_locator.get());
+// setLocatorResponses(responses_from_locator.get());
+// setServerLoadUpdates(serverLoadUpdates.get());
+// }
}
diff --git
a/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockStatsImpl.java
b/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockStatsImpl.java
index 50d5db8..d827c2c 100755
---
a/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockStatsImpl.java
+++
b/geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockStatsImpl.java
@@ -19,6 +19,7 @@ import
org.apache.geode.distributed.internal.DistributionStatsImpl;
import org.apache.geode.stats.common.distributed.internal.PoolStatHelper;
import org.apache.geode.stats.common.distributed.internal.QueueStatHelper;
import org.apache.geode.stats.common.distributed.internal.locks.DLockStats;
+import org.apache.geode.stats.common.statistics.GFSStatsImplementer;
import org.apache.geode.stats.common.statistics.StatisticDescriptor;
import org.apache.geode.stats.common.statistics.Statistics;
import org.apache.geode.stats.common.statistics.StatisticsFactory;
@@ -29,7 +30,7 @@ import
org.apache.geode.stats.common.statistics.StatisticsType;
*
*
*/
-public class DLockStatsImpl implements DLockStats {
+public class DLockStatsImpl implements DLockStats, GFSStatsImplementer {
// -------------------------------------------------------------------------
// Statistic "Id" Fields
@@ -109,7 +110,7 @@ public class DLockStatsImpl implements DLockStats {
return System.nanoTime();
}
- private void initializeStats(StatisticsFactory factory) {
+ public void initializeStats(StatisticsFactory factory) {
String statName = "DLockStats";
String statDescription = "Statistics on the gemfire distribution lock
service.";
@@ -423,9 +424,9 @@ public class DLockStatsImpl implements DLockStats {
/**
* Creates a new <code>DLockStats</code> and registers itself with the given
statistics factory.
*/
- public DLockStatsImpl(StatisticsFactory factory, long statId) {
+ public DLockStatsImpl(StatisticsFactory factory, String statId) {
initializeStats(factory);
- this.stats = factory.createAtomicStatistics(type, "dlockStats", statId);
+ this.stats = factory.createAtomicStatistics(type, "dlockStats",
Long.parseLong(statId));
}
// -------------------------------------------------------------------------
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/cache/CachePerfStatsImpl.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/CachePerfStatsImpl.java
index 01f1db7..b105a2d 100644
---
a/geode-core/src/main/java/org/apache/geode/internal/cache/CachePerfStatsImpl.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/cache/CachePerfStatsImpl.java
@@ -35,129 +35,129 @@ public class CachePerfStatsImpl implements
CachePerfStats, GFSStatsImplementer {
private StatisticsType type;
- protected int loadsInProgressId;
- protected int loadsCompletedId;
- protected int loadTimeId;
- protected int netloadsInProgressId;
- protected int netloadsCompletedId;
- protected int netloadTimeId;
- protected int netsearchesInProgressId;
- protected int netsearchesCompletedId;
- protected int netsearchTimeId;
- protected int cacheWriterCallsInProgressId;
- protected int cacheWriterCallsCompletedId;
- protected int cacheWriterCallTimeId;
- protected int cacheListenerCallsInProgressId;
- protected int cacheListenerCallsCompletedId;
- protected int cacheListenerCallTimeId;
- protected int getInitialImagesInProgressId;
- protected int getInitialImagesCompletedId;
- protected int deltaGetInitialImagesCompletedId;
- protected int getInitialImageTimeId;
- protected int getInitialImageKeysReceivedId;
- protected int regionsId;
- protected int partitionedRegionsId;
- protected int destroysId;
- protected int createsId;
- protected int putsId;
- protected int putTimeId;
- protected int putallsId;
- protected int putallTimeId;
- protected int removeAllsId;
- protected int removeAllTimeId;
- protected int updatesId;
- protected int updateTimeId;
- protected int invalidatesId;
- protected int getsId;
- protected int getTimeId;
- protected int eventQueueSizeId;
- protected int eventQueueThrottleTimeId;
- protected int eventQueueThrottleCountId;
- protected int eventThreadsId;
- protected int missesId;
- protected int queryExecutionsId;
- protected int queryExecutionTimeId;
- protected int queryResultsHashCollisionsId;
- protected int queryResultsHashCollisionProbeTimeId;
- protected int partitionedRegionQueryRetriesId;
-
- protected int txSuccessLifeTimeId;
- protected int txFailedLifeTimeId;
- protected int txRollbackLifeTimeId;
- protected int txCommitsId;
- protected int txFailuresId;
- protected int txRollbacksId;
- protected int txCommitTimeId;
- protected int txFailureTimeId;
- protected int txRollbackTimeId;
- protected int txCommitChangesId;
- protected int txFailureChangesId;
- protected int txRollbackChangesId;
- protected int txConflictCheckTimeId;
-
- protected int reliableQueuedOpsId;
- protected int reliableQueueSizeId;
- protected int reliableQueueMaxId;
- protected int reliableRegionsId;
- protected int reliableRegionsMissingId;
- protected int reliableRegionsQueuingId;
- protected int reliableRegionsMissingFullAccessId;
- protected int reliableRegionsMissingLimitedAccessId;
- protected int reliableRegionsMissingNoAccessId;
- protected int entryCountId;
- protected int eventsQueuedId;
- protected int retriesId;
-
- protected int diskTasksWaitingId;
- protected int evictorJobsStartedId;
- protected int evictorJobsCompletedId;
- protected int evictorQueueSizeId;
-
- protected int evictWorkTimeId;
-
-
- protected int indexUpdateInProgressId;
- protected int indexUpdateCompletedId;
- protected int indexUpdateTimeId;
- protected int clearsId;
- protected int indexInitializationInProgressId;
- protected int indexInitializationCompletedId;
- protected int indexInitializationTimeId;
+ int loadsInProgressId;
+ int loadsCompletedId;
+ int loadTimeId;
+ int netloadsInProgressId;
+ int netloadsCompletedId;
+ int netloadTimeId;
+ int netsearchesInProgressId;
+ int netsearchesCompletedId;
+ int netsearchTimeId;
+ int cacheWriterCallsInProgressId;
+ int cacheWriterCallsCompletedId;
+ int cacheWriterCallTimeId;
+ int cacheListenerCallsInProgressId;
+ int cacheListenerCallsCompletedId;
+ int cacheListenerCallTimeId;
+ int getInitialImagesInProgressId;
+ int getInitialImagesCompletedId;
+ private int deltaGetInitialImagesCompletedId;
+ int getInitialImageTimeId;
+ int getInitialImageKeysReceivedId;
+ int regionsId;
+ int partitionedRegionsId;
+ int destroysId;
+ int createsId;
+ int putsId;
+ int putTimeId;
+ int putallsId;
+ int putallTimeId;
+ private int removeAllsId;
+ private int removeAllTimeId;
+ int updatesId;
+ int updateTimeId;
+ int invalidatesId;
+ int getsId;
+ int getTimeId;
+ int eventQueueSizeId;
+ int eventQueueThrottleTimeId;
+ int eventQueueThrottleCountId;
+ int eventThreadsId;
+ int missesId;
+ int queryExecutionsId;
+ int queryExecutionTimeId;
+ int queryResultsHashCollisionsId;
+ int queryResultsHashCollisionProbeTimeId;
+ int partitionedRegionQueryRetriesId;
+
+ int txSuccessLifeTimeId;
+ int txFailedLifeTimeId;
+ int txRollbackLifeTimeId;
+ int txCommitsId;
+ int txFailuresId;
+ int txRollbacksId;
+ int txCommitTimeId;
+ int txFailureTimeId;
+ int txRollbackTimeId;
+ int txCommitChangesId;
+ int txFailureChangesId;
+ int txRollbackChangesId;
+ int txConflictCheckTimeId;
+
+ int reliableQueuedOpsId;
+ int reliableQueueSizeId;
+ int reliableQueueMaxId;
+ int reliableRegionsId;
+ int reliableRegionsMissingId;
+ int reliableRegionsQueuingId;
+ int reliableRegionsMissingFullAccessId;
+ int reliableRegionsMissingLimitedAccessId;
+ int reliableRegionsMissingNoAccessId;
+ int entryCountId;
+ int eventsQueuedId;
+ int retriesId;
+
+ int diskTasksWaitingId;
+ int evictorJobsStartedId;
+ int evictorJobsCompletedId;
+ int evictorQueueSizeId;
+
+ int evictWorkTimeId;
+
+
+ int indexUpdateInProgressId;
+ int indexUpdateCompletedId;
+ int indexUpdateTimeId;
+ int clearsId;
+ private int indexInitializationInProgressId;
+ private int indexInitializationCompletedId;
+ private int indexInitializationTimeId;
/**
* Id of the meta data refresh statistic
*/
- protected int metaDataRefreshCountId;
-
- protected int conflatedEventsId;
- protected int tombstoneCountId;
- protected int tombstoneGCCountId;
- protected int tombstoneOverhead1Id;
- protected int tombstoneOverhead2Id;
- protected int clearTimeoutsId;
-
- protected int deltaUpdatesId;
- protected int deltaUpdatesTimeId;
- protected int deltaFailedUpdatesId;
-
- protected int deltasPreparedId;
- protected int deltasPreparedTimeId;
- protected int deltasSentId;
-
- protected int deltaFullValuesSentId;
- protected int deltaFullValuesRequestedId;
-
- protected int importedEntriesCountId;
- protected int importTimeId;
- protected int exportedEntriesCountId;
- protected int exportTimeId;
-
- protected int compressionCompressTimeId;
- protected int compressionDecompressTimeId;
- protected int compressionCompressionsId;
- protected int compressionDecompressionsId;
- protected int compressionPreCompressedBytesId;
- protected int compressionPostCompressedBytesId;
+ int metaDataRefreshCountId;
+
+ int conflatedEventsId;
+ int tombstoneCountId;
+ int tombstoneGCCountId;
+ private int tombstoneOverhead1Id;
+ private int tombstoneOverhead2Id;
+ int clearTimeoutsId;
+
+ private int deltaUpdatesId;
+ private int deltaUpdatesTimeId;
+ private int deltaFailedUpdatesId;
+
+ private int deltasPreparedId;
+ private int deltasPreparedTimeId;
+ private int deltasSentId;
+
+ private int deltaFullValuesSentId;
+ private int deltaFullValuesRequestedId;
+
+ int importedEntriesCountId;
+ int importTimeId;
+ int exportedEntriesCountId;
+ int exportTimeId;
+
+ private int compressionCompressTimeId;
+ private int compressionDecompressTimeId;
+ private int compressionCompressionsId;
+ private int compressionDecompressionsId;
+ int compressionPreCompressedBytesId;
+ int compressionPostCompressedBytesId;
/**
* The Statistics object that we delegate most behavior to
@@ -1064,10 +1064,8 @@ public class CachePerfStatsImpl implements
CachePerfStats, GFSStatsImplementer {
public void endLoad(long start) {
// note that load times are used in health checks and
// should not be disabled by enableClockStats==false
- long ts = NanoTimer.getTime(); // don't use getStatTime so always enabled
- stats.incLong(loadTimeId, ts - start);
- stats.incInt(loadsInProgressId, -1);
- stats.incInt(loadsCompletedId, 1);
+ calculateEndTimeMetrics(start, loadTimeId, loadsInProgressId,
+ loadsCompletedId);
}
/**
@@ -1107,10 +1105,17 @@ public class CachePerfStatsImpl implements
CachePerfStats, GFSStatsImplementer {
public void endNetsearch(long start) {
// note that netsearch is used in health checks and timings should
// not be disabled by enableClockStats==false
- long ts = NanoTimer.getTime(); // don't use getStatTime so always enabled
- stats.incLong(netsearchTimeId, ts - start);
- stats.incInt(netsearchesInProgressId, -1);
- stats.incInt(netsearchesCompletedId, 1);
+ calculateEndTimeMetrics(start, netsearchTimeId, netsearchesInProgressId,
+ netsearchesCompletedId);
+ }
+
+ private void calculateEndTimeMetrics(long start, int deltaTimeId,
+ int inProgressId, int completedId) {
+ if (enableClockStats) {
+ stats.incLong(deltaTimeId, NanoTimer.getTime() - start);
+ }
+ stats.incInt(inProgressId, -1);
+ stats.incInt(completedId, 1);
}
/**
@@ -1127,11 +1132,7 @@ public class CachePerfStatsImpl implements
CachePerfStats, GFSStatsImplementer {
*/
@Override
public void endCacheWriterCall(long start) {
- if (enableClockStats) {
- stats.incLong(cacheWriterCallTimeId, CachePerfStats.getStatTime() -
start);
- }
- stats.incInt(cacheWriterCallsInProgressId, -1);
- stats.incInt(cacheWriterCallsCompletedId, 1);
+
calculateEndTimeMetrics(start,cacheWriterCallTimeId,cacheWriterCallsInProgressId,cacheWriterCallsCompletedId);
}
/**
@@ -1150,11 +1151,7 @@ public class CachePerfStatsImpl implements
CachePerfStats, GFSStatsImplementer {
*/
@Override
public void endCacheListenerCall(long start) {
- if (enableClockStats) {
- stats.incLong(cacheListenerCallTimeId, CachePerfStats.getStatTime() -
start);
- }
- stats.incInt(cacheListenerCallsInProgressId, -1);
- stats.incInt(cacheListenerCallsCompletedId, 1);
+
calculateEndTimeMetrics(start,cacheListenerCallTimeId,cacheListenerCallsInProgressId,cacheListenerCallsCompletedId);
}
/**
@@ -1171,11 +1168,7 @@ public class CachePerfStatsImpl implements
CachePerfStats, GFSStatsImplementer {
*/
@Override
public void endGetInitialImage(long start) {
- if (enableClockStats) {
- stats.incLong(getInitialImageTimeId, CachePerfStats.getStatTime() -
start);
- }
- stats.incInt(getInitialImagesInProgressId, -1);
- stats.incInt(getInitialImagesCompletedId, 1);
+
calculateEndTimeMetrics(start,getInitialImageTimeId,getInitialImagesInProgressId,getInitialImagesCompletedId);
}
/**
@@ -1207,10 +1200,8 @@ public class CachePerfStatsImpl implements
CachePerfStats, GFSStatsImplementer {
@Override
public void endIndexUpdate(long start) {
- long ts = CachePerfStats.getStatTime();
- stats.incLong(indexUpdateTimeId, ts - start);
- stats.incInt(indexUpdateInProgressId, -1);
- stats.incInt(indexUpdateCompletedId, 1);
+ calculateEndTimeMetrics(start, indexUpdateTimeId,
+ indexUpdateInProgressId, indexUpdateCompletedId);
}
@Override
@@ -1221,10 +1212,8 @@ public class CachePerfStatsImpl implements
CachePerfStats, GFSStatsImplementer {
@Override
public void endIndexInitialization(long start) {
- long ts = CachePerfStats.getStatTime();
- stats.incLong(indexInitializationTimeId, ts - start);
- stats.incInt(indexInitializationInProgressId, -1);
- stats.incInt(indexInitializationCompletedId, 1);
+ calculateEndTimeMetrics(start, indexInitializationTimeId,
+ indexInitializationInProgressId, indexInitializationCompletedId);
}
@Override
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreStatsImpl.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreStatsImpl.java
index eb7e5fb..53b5776 100644
---
a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreStatsImpl.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreStatsImpl.java
@@ -15,6 +15,7 @@
package org.apache.geode.internal.cache;
import org.apache.geode.stats.common.internal.cache.DiskStoreStats;
+import org.apache.geode.stats.common.statistics.GFSStatsImplementer;
import org.apache.geode.stats.common.statistics.StatisticDescriptor;
import org.apache.geode.stats.common.statistics.Statistics;
import org.apache.geode.stats.common.statistics.StatisticsFactory;
@@ -22,16 +23,17 @@ import
org.apache.geode.stats.common.statistics.StatisticsType;
/**
* GemFire statistics about a {@link DiskStoreImpl}.
- *
- *
* @since GemFire prPersistSprint2
*/
-public class DiskStoreStatsImpl implements DiskStoreStats {
+public class DiskStoreStatsImpl implements DiskStoreStats, GFSStatsImplementer
{
- private StatisticsType type;
+ /**
+ * The Statistics object that we delegate most behavior to
+ */
+ private final Statistics stats;
//////////////////// Statistic "Id" Fields ////////////////////
-
+ private StatisticsType type;
private int writesId;
private int writeTimeId;
private int bytesWrittenId;
@@ -60,30 +62,39 @@ public class DiskStoreStatsImpl implements DiskStoreStats {
private int removesId;
private int removeTimeId;
private int queueSizeId;
-
private int compactInsertsId;
private int compactInsertTimeId;
private int compactUpdatesId;
private int compactUpdateTimeId;
private int compactDeletesId;
private int compactDeleteTimeId;
-
private int openOplogsId;
private int inactiveOplogsId;
private int compactableOplogsId;
-
private int oplogReadsId;
private int oplogSeeksId;
-
private int uncreatedRecoveredRegionsId;
private int backupsInProgress;
private int backupsCompleted;
- private void initializeStats(StatisticsFactory factory) {
+ ////////////////////// Instance Fields //////////////////////
+
+ /**
+ * Creates a new <code>DiskStoreStatistics</code> for the given region.
+ */
+ public DiskStoreStatsImpl(StatisticsFactory factory, String name) {
+ initializeStats(factory);
+ this.stats = factory.createAtomicStatistics(type, name);
+ }
+
+ /////////////////////// Constructors ///////////////////////
+
+ public void initializeStats(StatisticsFactory factory) {
String statName = "DiskStoreStatistics";
String statDescription = "Statistics about a Region's use of the disk";
- final String writesDesc =
+ final String
+ writesDesc =
"The total number of region entries that have been written to disk. A
write is done every time an entry is created on disk or every time its value is
modified on disk.";
final String writeTimeDesc = "The total amount of time spent writing to
disk";
final String bytesWrittenDesc = "The total number of bytes that have been
written to disk";
@@ -113,7 +124,7 @@ public class DiskStoreStatsImpl implements DiskStoreStats {
"The number of backups of this disk store that have been taking while
this VM was alive";
type = factory.createType(statName, statDescription,
- new StatisticDescriptor[] {factory.createLongCounter("writes",
writesDesc, "ops"),
+ new StatisticDescriptor[]{factory.createLongCounter("writes",
writesDesc, "ops"),
factory.createLongCounter("writeTime", writeTimeDesc,
"nanoseconds"),
factory.createLongCounter("writtenBytes", bytesWrittenDesc,
"bytes"),
factory.createLongCounter("flushes", flushesDesc, "ops"),
@@ -238,21 +249,6 @@ public class DiskStoreStatsImpl implements DiskStoreStats {
backupsCompleted = type.nameToId("backupsCompleted");
}
- ////////////////////// Instance Fields //////////////////////
-
- /** The Statistics object that we delegate most behavior to */
- private final Statistics stats;
-
- /////////////////////// Constructors ///////////////////////
-
- /**
- * Creates a new <code>DiskStoreStatistics</code> for the given region.
- */
- public DiskStoreStatsImpl(StatisticsFactory factory, String name) {
- initializeStats(factory);
- this.stats = factory.createAtomicStatistics(type, name);
- }
-
///////////////////// Instance Methods /////////////////////
@Override
@@ -349,9 +345,7 @@ public class DiskStoreStatsImpl implements DiskStoreStats {
/**
* Invoked before data is written to disk.
- *
* @return The timestamp that marks the start of the operation
- *
* @see DiskRegion#put
*/
@Override
@@ -373,7 +367,6 @@ public class DiskStoreStatsImpl implements DiskStoreStats {
/**
* Invoked after data has been written to disk
- *
* @param start The time at which the write operation started
*/
@Override
@@ -400,9 +393,7 @@ public class DiskStoreStatsImpl implements DiskStoreStats {
/**
* Invoked before data is read from disk.
- *
* @return The timestamp that marks the start of the operation
- *
* @see DiskRegion#get
*/
@Override
@@ -412,7 +403,6 @@ public class DiskStoreStatsImpl implements DiskStoreStats {
/**
* Invoked after data has been read from disk
- *
* @param start The time at which the read operation started
* @param bytesRead The number of bytes that were read
*/
@@ -427,9 +417,7 @@ public class DiskStoreStatsImpl implements DiskStoreStats {
/**
* Invoked before data is recovered from disk.
- *
* @return The timestamp that marks the start of the operation
- *
*/
@Override
public long startRecovery() {
@@ -450,7 +438,6 @@ public class DiskStoreStatsImpl implements DiskStoreStats {
/**
* Invoked after data has been recovered from disk
- *
* @param start The time at which the recovery operation started
* @param bytesRead The number of bytes that were recovered
*/
@@ -505,9 +492,7 @@ public class DiskStoreStatsImpl implements DiskStoreStats {
/**
* Invoked before data is removed from disk.
- *
* @return The timestamp that marks the start of the operation
- *
* @see DiskRegion#remove
*/
@Override
@@ -517,7 +502,6 @@ public class DiskStoreStatsImpl implements DiskStoreStats {
/**
* Invoked after data has been removed from disk
- *
* @param start The time at which the read operation started
*/
@Override
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/cache/RegionPerfStatsImpl.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/RegionPerfStatsImpl.java
index fed258d..9066cf9 100644
---
a/geode-core/src/main/java/org/apache/geode/internal/cache/RegionPerfStatsImpl.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/cache/RegionPerfStatsImpl.java
@@ -22,7 +22,7 @@ import
org.apache.geode.stats.common.statistics.StatisticsFactory;
public class RegionPerfStatsImpl extends CachePerfStatsImpl implements
RegionPerfStats {
CachePerfStats cachePerfStats;
- RegionPerfStatsImpl(StatisticsFactory statisticsFactory, CachePerfStats
superStats,
+ public RegionPerfStatsImpl(StatisticsFactory statisticsFactory,
CachePerfStats superStats,
String regionName) {
super(statisticsFactory, regionName);
this.cachePerfStats = superStats;
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionServiceStats.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionServiceStatsImpl.java
similarity index 96%
rename from
geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionServiceStats.java
rename to
geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionServiceStatsImpl.java
index 3ddab21..0c26860 100644
---
a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionServiceStats.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionServiceStatsImpl.java
@@ -14,12 +14,13 @@
*/
package org.apache.geode.internal.cache.execute;
+import org.apache.geode.stats.common.statistics.GFSStatsImplementer;
import org.apache.geode.stats.common.statistics.StatisticDescriptor;
import org.apache.geode.stats.common.statistics.Statistics;
import org.apache.geode.stats.common.statistics.StatisticsFactory;
import org.apache.geode.stats.common.statistics.StatisticsType;
-public class FunctionServiceStats {
+public class FunctionServiceStatsImpl implements FunctionServiceStats,
GFSStatsImplementer {
/** The <code>StatisticsType</code> of the statistics */
private StatisticsType _type;
@@ -111,7 +112,7 @@ public class FunctionServiceStats {
/**
* Static initializer to create and initialize the
<code>StatisticsType</code>
*/
- private void initializeStats(StatisticsFactory factory) {
+ public void initializeStats(StatisticsFactory factory) {
String statName = "FunctionServiceStatistics";
String statDescription =
"This is the aggregate Function Execution Stats (for all function
Executions)";
@@ -174,7 +175,7 @@ public class FunctionServiceStats {
* instance
* @param name The name of the <code>Statistics</code>
*/
- public FunctionServiceStats(StatisticsFactory factory, String name) {
+ public FunctionServiceStatsImpl(StatisticsFactory factory, String name) {
initializeStats(factory);
this._stats = factory.createAtomicStatistics(_type, name);
}
@@ -193,6 +194,7 @@ public class FunctionServiceStats {
*
* @return the current value of the "function Executions completed" stat
*/
+ @Override
public int getFunctionExecutionsCompleted() {
return this._stats.getInt(_functionExecutionsCompletedId);
}
@@ -200,6 +202,7 @@ public class FunctionServiceStats {
/**
* Increments the "FunctionExecutionsCompleted" stat.
*/
+ @Override
public void incFunctionExecutionsCompleted() {
this._stats.incInt(_functionExecutionsCompletedId, 1);
}
@@ -209,6 +212,7 @@ public class FunctionServiceStats {
*
* @return the current value of the
"functionExecutionCompleteProcessingTime" stat
*/
+ @Override
public long getFunctionExecutionCompleteProcessingTime() {
return this._stats.getLong(_functionExecutionsCompletedProcessingTimeId);
}
@@ -218,6 +222,7 @@ public class FunctionServiceStats {
*
* @return the current value of the "functionExecutionsRunning" stat
*/
+ @Override
public int getFunctionExecutionsRunning() {
return this._stats.getInt(_functionExecutionsRunningId);
}
@@ -225,6 +230,7 @@ public class FunctionServiceStats {
/**
* Increments the "FunctionExecutionsRunning" stat.
*/
+ @Override
public void incFunctionExecutionsRunning() {
this._stats.incInt(_functionExecutionsRunningId, 1);
}
@@ -234,6 +240,7 @@ public class FunctionServiceStats {
*
* @return the current value of the "resultsReturned" stat
*/
+ @Override
public int getResultsSentToResultCollector() {
return this._stats.getInt(_resultsSentToResultCollectorId);
}
@@ -241,6 +248,7 @@ public class FunctionServiceStats {
/**
* Increments the "ResultsReturnedToResultCollector" stat.
*/
+ @Override
public void incResultsReturned() {
this._stats.incInt(_resultsSentToResultCollectorId, 1);
}
@@ -251,6 +259,7 @@ public class FunctionServiceStats {
*
* @return the current value of the "resultsReturned" stat
*/
+ @Override
public int getResultsReceived() {
return this._stats.getInt(_resultsReceived);
}
@@ -258,6 +267,7 @@ public class FunctionServiceStats {
/**
* Increments the "ResultsReturnedToResultCollector" stat.
*/
+ @Override
public void incResultsReceived() {
this._stats.incInt(_resultsReceived, 1);
}
@@ -267,6 +277,7 @@ public class FunctionServiceStats {
*
* @return the current value of the "functionExecutionsCall" stat
*/
+ @Override
public int getFunctionExecutionCalls() {
return this._stats.getInt(_functionExecutionCallsId);
}
@@ -274,6 +285,7 @@ public class FunctionServiceStats {
/**
* Increments the "FunctionExecutionsCall" stat.
*/
+ @Override
public void incFunctionExecutionCalls() {
this._stats.incInt(_functionExecutionCallsId, 1);
}
@@ -284,6 +296,7 @@ public class FunctionServiceStats {
*
* @return the current value of the
"functionExecutionHasResultCompleteProcessingTime" stat
*/
+ @Override
public int getFunctionExecutionHasResultCompleteProcessingTime() {
return
this._stats.getInt(_functionExecutionsHasResultCompletedProcessingTimeId);
}
@@ -294,6 +307,7 @@ public class FunctionServiceStats {
*
* @return the current value of the "functionExecutionHasResultRunning" stat
*/
+ @Override
public int getFunctionExecutionHasResultRunning() {
return this._stats.getInt(_functionExecutionsHasResultRunningId);
}
@@ -301,6 +315,7 @@ public class FunctionServiceStats {
/**
* Increments the "FunctionExecutionsCall" stat.
*/
+ @Override
public void incFunctionExecutionHasResultRunning() {
this._stats.incInt(_functionExecutionsHasResultRunningId, 1);
}
@@ -311,6 +326,7 @@ public class FunctionServiceStats {
*
* @return the current value of the "functionExecutionHasResultRunning" stat
*/
+ @Override
public int getFunctionExecutionExceptions() {
return this._stats.getInt(_functionExecutionExceptions);
}
@@ -318,6 +334,7 @@ public class FunctionServiceStats {
/**
* Increments the "FunctionExecutionsCall" stat.
*/
+ @Override
public void incFunctionExecutionExceptions() {
this._stats.incInt(_functionExecutionExceptions, 1);
}
@@ -327,6 +344,7 @@ public class FunctionServiceStats {
*
* @return the current time (ns)
*/
+ @Override
public long startTime() {
return System.nanoTime();
}
@@ -335,6 +353,7 @@ public class FunctionServiceStats {
* Increments the "_functionExecutionCallsId" and
"_functionExecutionsRunningId" stats and
* "_functionExecutionHasResultRunningId" in case of function.hasResult =
true..
*/
+ @Override
public void startFunctionExecution(boolean haveResult) {
// Increment number of function execution calls
this._stats.incInt(_functionExecutionCallsId, 1);
@@ -357,6 +376,7 @@ public class FunctionServiceStats {
* @param haveResult haveResult=true then update the
_functionExecutionHasResultRunningId and
* _functionExecutionHasResultCompleteProcessingTimeId
*/
+ @Override
public void endFunctionExecution(long start, boolean haveResult) {
long ts = System.nanoTime();
@@ -384,6 +404,7 @@ public class FunctionServiceStats {
* Increments the "_functionExecutionException" and decrements
"_functionExecutionsRunningId"
*
*/
+ @Override
public void endFunctionExecutionWithException(boolean haveResult) {
// Decrement function Executions running.
this._stats.incInt(_functionExecutionsRunningId, -1);
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheServerStatsImpl.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheServerStatsImpl.java
index 2ba90da..735901f 100644
---
a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheServerStatsImpl.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheServerStatsImpl.java
@@ -225,8 +225,8 @@ public class CacheServerStatsImpl implements
CacheServerStats, GFSStatsImplement
protected StatisticsType statType;
- public CacheServerStatsImpl(String ownerName) {
- this(InternalDistributedSystem.getAnyInstance().getStatisticsFactory(),
ownerName, typeName,
+ public CacheServerStatsImpl(StatisticsFactory statisticsFactory, String
ownerName) {
+ this(statisticsFactory, ownerName, typeName,
null);
}
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/statistics/GFSStatisticsFactoryImpl.java
b/geode-core/src/main/java/org/apache/geode/internal/statistics/GFSStatisticsFactoryImpl.java
index d6bee4a..2decfed 100644
---
a/geode-core/src/main/java/org/apache/geode/internal/statistics/GFSStatisticsFactoryImpl.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/statistics/GFSStatisticsFactoryImpl.java
@@ -26,6 +26,8 @@ public class GFSStatisticsFactoryImpl implements
StatisticsFactory, StatisticsMa
// StatisticsTypeFactory methods
private StatisticsTypeFactory statisticsTypeFactory = new
StatisticsTypeFactoryImpl();
+ public GFSStatisticsFactoryImpl() {}
+
@Override
public int getStatListModCount() {
return this.statsListModCount;
@@ -177,7 +179,7 @@ public class GFSStatisticsFactoryImpl implements
StatisticsFactory, StatisticsMa
@Override
public Statistics createStatistics(StatisticsType type, String textId) {
- return statisticsTypeFactory.createOsStatistics(type, textId, 0, 0);
+ return createOsStatistics(type, textId, 0, 0);
}
@Override
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 508d79c..476a84a 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
@@ -47,40 +47,35 @@ public class InternalDistributedSystemStats {
private StatisticsFactory statisticsFactory =
StatsFactory.getStatisticsFactory();
- 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) {
- this.statsDisabled = statsDisabled;
- this.functionServiceStats =
- StatsFactory.createStatsImpl(FunctionServiceStats.class,
"FunctionExecution");
- if (!statsDisabled && StatsFactory.isLegacyGeodeStats()) {
- this.sampler = new GemFireStatSampler(internalDistributedSystem.getId(),
distributionConfig,
- internalDistributedSystem.getCancelCriterion(), this,
- internalDistributedSystem.getDistributionManager());
- this.sampler.start();
-
- }
+ private InternalDistributedSystemStats() {
}
- public static InternalDistributedSystemStats createInstance(boolean
statsDisabled,
- DistributionConfig distributionConfig,
- InternalDistributedSystem distributedSystem) {
+ public static InternalDistributedSystemStats createInstance(boolean
statsDisabled) {
singleton.statsDisabled = statsDisabled;
singleton.functionServiceStats =
StatsFactory.createStatsImpl(FunctionServiceStats.class,
"FunctionExecution");
+ return singleton;
+ }
+
+ private static void startGemFireStatSampler(boolean statsDisabled,
+ DistributionConfig
distributionConfig,
+ InternalDistributedSystem
distributedSystem,
+ InternalDistributedSystemStats
internalDistributedSystemStats) {
if (!statsDisabled && StatsFactory.isLegacyGeodeStats()) {
- singleton.sampler = new GemFireStatSampler(distributedSystem.getId(),
distributionConfig,
- distributedSystem.getCancelCriterion(), singleton,
- distributedSystem.getDistributionManager());
- singleton.sampler.start();
+ internalDistributedSystemStats.sampler =
+ new GemFireStatSampler(distributedSystem.getId(), distributionConfig,
+ distributedSystem.getCancelCriterion(),
internalDistributedSystemStats,
+ distributedSystem.getDistributionManager());
+ internalDistributedSystemStats.sampler.start();
}
- return singleton;
+ }
+
+ public void startGemFireStatSampler(boolean statsDisabled,
+ DistributionConfig
distributionConfig,
+ InternalDistributedSystem
distributedSystem) {
+ startGemFireStatSampler(statsDisabled, distributionConfig,
distributedSystem, this);
}
public static InternalDistributedSystemStats getSingleton() {
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/statistics/SimpleStatSampler.java
b/geode-core/src/main/java/org/apache/geode/internal/statistics/SimpleStatSampler.java
index fe9a520..37c93fa 100644
---
a/geode-core/src/main/java/org/apache/geode/internal/statistics/SimpleStatSampler.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/statistics/SimpleStatSampler.java
@@ -37,33 +37,33 @@ public class SimpleStatSampler extends HostStatSampler {
private static final Logger logger = LogService.getLogger();
- public static final String ARCHIVE_FILE_NAME_PROPERTY = "stats.archive-file";
- public static final String FILE_SIZE_LIMIT_PROPERTY =
"stats.file-size-limit";
- public static final String DISK_SPACE_LIMIT_PROPERTY =
"stats.disk-space-limit";
- public static final String SAMPLE_RATE_PROPERTY = "stats.sample-rate";
+ static final String ARCHIVE_FILE_NAME_PROPERTY = "stats.archive-file";
+ static final String FILE_SIZE_LIMIT_PROPERTY = "stats.file-size-limit";
+ static final String DISK_SPACE_LIMIT_PROPERTY = "stats.disk-space-limit";
+ static final String SAMPLE_RATE_PROPERTY = "stats.sample-rate";
- public static final String DEFAULT_ARCHIVE_FILE_NAME = "stats.gfs";
- public static final long DEFAULT_FILE_SIZE_LIMIT = 0;
- public static final long DEFAULT_DISK_SPACE_LIMIT = 0;
- public static final int DEFAULT_SAMPLE_RATE = 1000;
+ static final String DEFAULT_ARCHIVE_FILE_NAME = "stats.gfs";
+ private static final long DEFAULT_FILE_SIZE_LIMIT = 0;
+ private static final long DEFAULT_DISK_SPACE_LIMIT = 0;
+ static final int DEFAULT_SAMPLE_RATE = 1000;
private final File archiveFileName =
new File(System.getProperty(ARCHIVE_FILE_NAME_PROPERTY,
DEFAULT_ARCHIVE_FILE_NAME));
private final long archiveFileSizeLimit =
- Long.getLong(FILE_SIZE_LIMIT_PROPERTY,
DEFAULT_FILE_SIZE_LIMIT).longValue() * (1024 * 1024);
+ Long.getLong(FILE_SIZE_LIMIT_PROPERTY, DEFAULT_FILE_SIZE_LIMIT) * (1024
* 1024);
private final long archiveDiskSpaceLimit =
- Long.getLong(DISK_SPACE_LIMIT_PROPERTY,
DEFAULT_DISK_SPACE_LIMIT).longValue() * (1024 * 1024);
+ Long.getLong(DISK_SPACE_LIMIT_PROPERTY, DEFAULT_DISK_SPACE_LIMIT) *
(1024 * 1024);
private final int sampleRate =
- Integer.getInteger(SAMPLE_RATE_PROPERTY, DEFAULT_SAMPLE_RATE).intValue();
+ Integer.getInteger(SAMPLE_RATE_PROPERTY, DEFAULT_SAMPLE_RATE);
private final StatisticsManager sm;
- public SimpleStatSampler(CancelCriterion stopper, StatisticsManager sm) {
+ SimpleStatSampler(CancelCriterion stopper, StatisticsManager sm) {
this(stopper, sm, new NanoTimer());
}
- public SimpleStatSampler(CancelCriterion stopper, StatisticsManager sm,
NanoTimer timer) {
- super(stopper, new StatSamplerStatsImpl(sm, sm.getId()), timer);
+ SimpleStatSampler(CancelCriterion stopper, StatisticsManager sm, NanoTimer
timer) {
+ super(stopper, new StatSamplerStatsImpl(sm, String.valueOf(sm.getId())),
timer);
this.sm = sm;
logger.info(LogMarker.STATISTICS_MARKER, LocalizedMessage
.create(LocalizedStrings.SimpleStatSampler_STATSSAMPLERATE_0,
getSampleRate()));
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/statistics/StatSamplerStatsImpl.java
b/geode-core/src/main/java/org/apache/geode/internal/statistics/StatSamplerStatsImpl.java
index 580be9c..abf9395 100644
---
a/geode-core/src/main/java/org/apache/geode/internal/statistics/StatSamplerStatsImpl.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/statistics/StatSamplerStatsImpl.java
@@ -43,9 +43,9 @@ public class StatSamplerStatsImpl implements StatSampleStats,
GFSStatsImplemente
private int sampleCallbackErrorsId;
private int sampleCallbackDurationId;
- public StatSamplerStatsImpl(StatisticsFactory factory, long id) {
+ public StatSamplerStatsImpl(StatisticsFactory factory, String id) {
initializeStats(factory);
- this.samplerStats = factory.createStatistics(samplerType, "statSampler",
id);
+ this.samplerStats = factory.createStatistics(samplerType, "statSampler",
Long.parseLong(id));
}
public void initializeStats(StatisticsFactory factory) {
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
b/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
index 3ac61aa..d55aadc 100644
---
a/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
+++
b/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
@@ -64,6 +64,7 @@ import org.apache.geode.internal.cache.InternalRegion;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.execute.FunctionServiceStats;
+import org.apache.geode.internal.cache.execute.FunctionServiceStatsImpl;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
diff --git
a/geode-core/src/main/resources/META-INF/services/org.apache.geode.stats.common.statistics.StatisticsFactory
b/geode-core/src/main/resources/META-INF/services/org.apache.geode.stats.common.statistics.StatisticsFactory
index db19fd9..55fa2b7 100644
---
a/geode-core/src/main/resources/META-INF/services/org.apache.geode.stats.common.statistics.StatisticsFactory
+++
b/geode-core/src/main/resources/META-INF/services/org.apache.geode.stats.common.statistics.StatisticsFactory
@@ -1 +1 @@
-org.apache.geode.internal.statistics.GFSStatisticFactoryImpl
\ No newline at end of file
+org.apache.geode.internal.statistics.GFSStatisticsFactoryImpl
\ No newline at end of file
diff --git
a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystemStats.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystemStats.java
index e651b7a..f720b4c 100644
---
a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystemStats.java
+++
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystemStats.java
@@ -21,6 +21,7 @@ import org.apache.geode.stats.common.statistics.Statistics;
import org.apache.geode.stats.common.statistics.StatisticsFactory;
import org.apache.geode.stats.common.statistics.StatisticsType;
+// TODO UDO: More metrics to be created
public class FileSystemStats {
private StatisticsType statsType;
private static final String statsTypeName = "FileSystemStats";
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCCUStatsImpl.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCCUStatsImpl.kt
index fe291ad..b8fdf57 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCCUStatsImpl.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCCUStatsImpl.kt
@@ -20,7 +20,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.CounterStatisticMete
import org.apache.geode.statistics.internal.micrometer.impl.GaugeStatisticMeter
import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
-class MicrometerCCUStatsImpl internal constructor(statisticsFactory:
StatisticsFactory?, private val serverLocation: String) :
+class MicrometerCCUStatsImpl internal constructor(statisticsFactory:
StatisticsFactory, private val serverLocation: String) :
CCUStats, MicrometerMeterGroup(statisticsFactory,
"CacheClientUpdaterStats-$serverLocation") {
override fun getGroupTags(): Array<String> = arrayOf("serverLocation",
serverLocation)
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCacheClientNotifierStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCacheClientNotifierStats.kt
index 8f29989..93f8d67 100755
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCacheClientNotifierStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCacheClientNotifierStats.kt
@@ -21,7 +21,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.GaugeStatisticMeter
import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
import org.apache.geode.statistics.util.NOW_NANOS
-class MicrometerCacheClientNotifierStats(statisticsFactory:
StatisticsFactory?, private val clientName: String) :
+class MicrometerCacheClientNotifierStats(statisticsFactory: StatisticsFactory,
private val clientName: String) :
MicrometerMeterGroup(statisticsFactory,"CacheClientNotifierStats-$clientName"),
CacheClientNotifierStats {
override fun getGroupTags(): Array<String> = arrayOf("clientName",
clientName)
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCacheClientProxyStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCacheClientProxyStats.kt
index d86f4ae..e4369ca 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCacheClientProxyStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCacheClientProxyStats.kt
@@ -21,7 +21,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.GaugeStatisticMeter
import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
import org.apache.geode.statistics.util.NOW_NANOS
-class MicrometerCacheClientProxyStats(statisticsFactory: StatisticsFactory?,
private val clientName: String) :
+class MicrometerCacheClientProxyStats(statisticsFactory: StatisticsFactory,
private val clientName: String) :
MicrometerMeterGroup(statisticsFactory,"CacheClientProxyStats-$clientName"),
MessageStats {
override fun getGroupTags(): Array<String> = arrayOf("clientName",
clientName)
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 86f1f4b..1823516 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
@@ -25,7 +25,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
import org.apache.geode.statistics.internal.micrometer.impl.TimerStatisticMeter
import org.apache.geode.statistics.util.NOW_NANOS
-open class MicrometerCachePerfStats @JvmOverloads
constructor(statisticsFactory: StatisticsFactory?, private val regionName:
String? = null) :
+open class MicrometerCachePerfStats @JvmOverloads
constructor(statisticsFactory: StatisticsFactory, private val regionName:
String? = null) :
MicrometerMeterGroup(statisticsFactory,"CachePerfStats${regionName?.let {
"-$it" }
?: ""}"), CachePerfStats {
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCacheServerStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCacheServerStats.kt
index 981d7fd..2af3ebf 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCacheServerStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/cache/MicrometerCacheServerStats.kt
@@ -23,7 +23,7 @@ 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
-open class MicrometerCacheServerStats @JvmOverloads
constructor(statisticsFactory: StatisticsFactory?, private val ownerName:
String, typeName: String = "CacheServerStats-$ownerName") :
+open class MicrometerCacheServerStats @JvmOverloads
constructor(statisticsFactory: StatisticsFactory, private val ownerName:
String, typeName: String = "CacheServerStats-$ownerName") :
MicrometerMeterGroup(statisticsFactory,"$typeName-$ownerName"),
CacheServerStats {
override fun getGroupTags(): Array<String> = arrayOf("owner", ownerName)
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/client/connection/MicrometerClientSendStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/client/connection/MicrometerClientSendStats.kt
index e7a7889..2ff7cd4 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/client/connection/MicrometerClientSendStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/client/connection/MicrometerClientSendStats.kt
@@ -19,7 +19,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.CounterStatisticMete
import org.apache.geode.statistics.internal.micrometer.impl.GaugeStatisticMeter
import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
-class MicrometerClientSendStats(statisticsFactory: StatisticsFactory?, private
val poolName:String) :
+class MicrometerClientSendStats(statisticsFactory: StatisticsFactory, private
val poolName:String) :
MicrometerMeterGroup(statisticsFactory,"ClientConnectionSendStats-$poolName") {
override fun getGroupTags(): Array<String> = arrayOf("poolName", poolName)
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/client/connection/MicrometerClientStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/client/connection/MicrometerClientStats.kt
index af90c4f..3d86d79 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/client/connection/MicrometerClientStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/client/connection/MicrometerClientStats.kt
@@ -19,7 +19,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.CounterStatisticMete
import org.apache.geode.statistics.internal.micrometer.impl.GaugeStatisticMeter
import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
-class MicrometerClientStats(statisticsFactory: StatisticsFactory?, private val
poolName:String) :
+class MicrometerClientStats(statisticsFactory: StatisticsFactory, private val
poolName:String) :
MicrometerMeterGroup(statisticsFactory,"ClientConnectionStats-$poolName") {
override fun getGroupTags(): Array<String> = arrayOf("poolName", poolName)
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/client/connection/MicrometerConnectionStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/client/connection/MicrometerConnectionStats.kt
index 59e213d..d02c42d 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/client/connection/MicrometerConnectionStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/client/connection/MicrometerConnectionStats.kt
@@ -22,13 +22,13 @@ import
org.apache.geode.statistics.internal.micrometer.impl.CounterStatisticMete
import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
import org.apache.geode.statistics.util.NOW_NANOS
-class MicrometerConnectionStats(private val statisticsFactory:
StatisticsFactory?, private val poolName: String, private var poolStats:
PoolStats) :
+class MicrometerConnectionStats(private val statisticsFactory:
StatisticsFactory, private val poolName: String, private var poolStats:
PoolStats) :
MicrometerMeterGroup(statisticsFactory,
"ClientConnectionStats-$poolName"), ConnectionStats {
private val clientStats: MicrometerClientStats =
MicrometerClientStats(statisticsFactory, poolName)
private val clientSendStats: MicrometerClientSendStats =
MicrometerClientSendStats(statisticsFactory, poolName)
- override fun registerStatsImplementer(factory: StatisticsFactory?) {
+ override fun registerStatsImplementer(factory: StatisticsFactory) {
registerMeterGroup(clientStats)
registerMeterGroup(clientSendStats)
super.registerStatsImplementer(factory)
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/client/connection/MicrometerPoolStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/client/connection/MicrometerPoolStats.kt
index dbc9df8..74151f0 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/client/connection/MicrometerPoolStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/client/connection/MicrometerPoolStats.kt
@@ -21,7 +21,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.GaugeStatisticMeter
import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
import org.apache.geode.statistics.util.NOW_NANOS
-class MicrometerPoolStats(statisticsFactory: StatisticsFactory?, val poolName:
String) :
+class MicrometerPoolStats(statisticsFactory: StatisticsFactory, val poolName:
String) :
MicrometerMeterGroup(statisticsFactory,"PoolStats-$poolName"),
PoolStats {
override fun getGroupTags(): Array<String> = arrayOf("poolName", poolName)
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/disk/MicrometerDiskDirectoryStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/disk/MicrometerDiskDirectoryStats.kt
index eddc6db..b7795ff 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/disk/MicrometerDiskDirectoryStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/disk/MicrometerDiskDirectoryStats.kt
@@ -21,7 +21,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.CounterStatisticMete
import org.apache.geode.statistics.internal.micrometer.impl.GaugeStatisticMeter
import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
-class MicrometerDiskDirectoryStats(statisticsFactory: StatisticsFactory?,
private val owner: String) :
+class MicrometerDiskDirectoryStats(statisticsFactory: StatisticsFactory,
private val owner: String) :
MicrometerMeterGroup(statisticsFactory,"DiskDirectoryStats-$owner"),
DiskDirectoryStats {
override fun getGroupTags(): Array<String> = arrayOf("directoryOwner",
owner)
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/disk/MicrometerDiskRegionStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/disk/MicrometerDiskRegionStats.kt
index b65949d..07ee704 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/disk/MicrometerDiskRegionStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/disk/MicrometerDiskRegionStats.kt
@@ -21,7 +21,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.CounterStatisticMete
import org.apache.geode.statistics.internal.micrometer.impl.GaugeStatisticMeter
import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
-class MicrometerDiskRegionStats(statisticsFactory: StatisticsFactory?, private
val diskRegionName: String) :
+class MicrometerDiskRegionStats(statisticsFactory: StatisticsFactory, private
val diskRegionName: String) :
MicrometerMeterGroup(statisticsFactory,"DiskRegionStats-$diskRegionName"),
DiskRegionStats {
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/disk/MicrometerDiskStoreStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/disk/MicrometerDiskStoreStats.kt
index 1c048ce..0fe2263 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/disk/MicrometerDiskStoreStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/disk/MicrometerDiskStoreStats.kt
@@ -23,7 +23,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
import org.apache.geode.statistics.internal.micrometer.impl.TimerStatisticMeter
import org.apache.geode.statistics.util.NOW_NANOS
-class MicrometerDiskStoreStats(statisticsFactory: StatisticsFactory?, private
val diskStoreName: String) :
+class MicrometerDiskStoreStats(statisticsFactory: StatisticsFactory, private
val diskStoreName: String) :
MicrometerMeterGroup(statisticsFactory,"DiskStoreStats-$diskStoreName"),
DiskStoreStats {
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/distributed/MicrometerDistributionStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/distributed/MicrometerDistributionStats.kt
index 85b5f0a..2b25c6b 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/distributed/MicrometerDistributionStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/distributed/MicrometerDistributionStats.kt
@@ -23,7 +23,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.TimerStatisticMeter
import org.apache.geode.statistics.util.NOW_NANOS
import org.apache.geode.stats.common.distributed.internal.*
-class MicrometerDistributionStats(statisticsFactory: StatisticsFactory?,
private val processID: String) :
+class MicrometerDistributionStats(statisticsFactory: StatisticsFactory,
private val processID: String) :
MicrometerMeterGroup(statisticsFactory,"DistributionStats-$processID"),
DistributionStats {
override fun getGroupTags(): Array<String> = arrayOf("processID",
processID.toString())
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/dlock/MicrometerDLockStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/dlock/MicrometerDLockStats.kt
index bc620d3..d9fc269 100755
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/dlock/MicrometerDLockStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/dlock/MicrometerDLockStats.kt
@@ -26,7 +26,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
import org.apache.geode.statistics.internal.micrometer.impl.TimerStatisticMeter
import org.apache.geode.statistics.util.NOW_NANOS
-class MicrometerDLockStats(statisticsFactory: StatisticsFactory?, private val
statMeter: String) :
+class MicrometerDLockStats(statisticsFactory: StatisticsFactory, private val
statMeter: String) :
MicrometerMeterGroup(statisticsFactory,"DLockStats-$statMeter"),
DLockStats {
override fun getGroupTags(): Array<String> = arrayOf("statsMeter",
statMeter)
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/eviction/MicrometerCountLRUStatistics.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/eviction/MicrometerCountLRUStatistics.kt
index 6186783..0617491 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/eviction/MicrometerCountLRUStatistics.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/eviction/MicrometerCountLRUStatistics.kt
@@ -18,7 +18,7 @@ import
org.apache.geode.stats.common.internal.cache.eviction.CountLRUEvictionSta
import org.apache.geode.stats.common.statistics.StatisticsFactory
import org.apache.geode.statistics.internal.micrometer.impl.GaugeStatisticMeter
-class MicrometerCountLRUStatistics(statisticsFactory: StatisticsFactory?,
private val name: String) :
+class MicrometerCountLRUStatistics(statisticsFactory: StatisticsFactory,
private val name: String) :
MicrometerEvictionStatsImpl(statisticsFactory, name,
"CountLRUStats-$name"), CountLRUEvictionStats {
private val countEvictionEntriesAllowedCount =
GaugeStatisticMeter("eviction.count.lru.entries.allowed.count", "Number of
entries allowed in this region.")
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/eviction/MicrometerEvictionStatsImpl.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/eviction/MicrometerEvictionStatsImpl.kt
index e2f701c..df01f8c 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/eviction/MicrometerEvictionStatsImpl.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/eviction/MicrometerEvictionStatsImpl.kt
@@ -21,7 +21,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.CounterStatisticMete
import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
-abstract class MicrometerEvictionStatsImpl(statisticsFactory:
StatisticsFactory?, private val regionName: String, private val groupName:
String = "EvictionStats-$regionName") :
+abstract class MicrometerEvictionStatsImpl(statisticsFactory:
StatisticsFactory, private val regionName: String, private val groupName:
String = "EvictionStats-$regionName") :
MicrometerMeterGroup(statisticsFactory,groupName), EvictionStats {
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/eviction/MicrometerHeapLRUStatistics.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/eviction/MicrometerHeapLRUStatistics.kt
index c93308e..d2439ef 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/eviction/MicrometerHeapLRUStatistics.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/eviction/MicrometerHeapLRUStatistics.kt
@@ -18,7 +18,7 @@ import
org.apache.geode.stats.common.internal.cache.eviction.HeapLRUEvictionStat
import org.apache.geode.stats.common.statistics.StatisticsFactory
import org.apache.geode.statistics.internal.micrometer.impl.GaugeStatisticMeter
-class MicrometerHeapLRUStatistics(statisticsFactory: StatisticsFactory?,
private val name: String) :
+class MicrometerHeapLRUStatistics(statisticsFactory: StatisticsFactory,
private val name: String) :
MicrometerEvictionStatsImpl(statisticsFactory, name,
"HeapLRUStatistics-$name"), HeapLRUEvictionStats {
private val heapEvictionEntryBytesMeter =
GaugeStatisticMeter("eviction.heap.lru.entries.bytes", "The amount of memory
currently used by regions configured for eviction.", meterUnit = "bytes")
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/eviction/MicrometerMemoryLRUStatistics.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/eviction/MicrometerMemoryLRUStatistics.kt
index 776c20f..d937aad 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/eviction/MicrometerMemoryLRUStatistics.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/eviction/MicrometerMemoryLRUStatistics.kt
@@ -18,7 +18,7 @@ import
org.apache.geode.stats.common.internal.cache.eviction.MemoryLRUEvictionSt
import org.apache.geode.stats.common.statistics.StatisticsFactory
import org.apache.geode.statistics.internal.micrometer.impl.GaugeStatisticMeter
-class MicrometerMemoryLRUStatistics(statisticsFactory: StatisticsFactory?,
private val name: String) :
+class MicrometerMemoryLRUStatistics(statisticsFactory: StatisticsFactory,
private val name: String) :
MicrometerEvictionStatsImpl(statisticsFactory,name,
"MemLRUStatistics-$name"), MemoryLRUEvictionStats {
override fun initializeStaticMeters() {
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/function/MicrometerFunctionServiceStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/function/MicrometerFunctionServiceStats.kt
new file mode 100644
index 0000000..8adfed3
--- /dev/null
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/function/MicrometerFunctionServiceStats.kt
@@ -0,0 +1,80 @@
+package org.apache.geode.statistics.function
+
+import org.apache.geode.internal.cache.execute.FunctionServiceStats
+import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
+import org.apache.geode.statistics.micrometer.MicrometerStatsImplementer
+import org.apache.geode.stats.common.statistics.Statistics
+import org.apache.geode.stats.common.statistics.StatisticsFactory
+
+class MicrometerFunctionServiceStats(statisticsFactory: StatisticsFactory,
private val identifier: String) :
+ MicrometerMeterGroup(statisticsFactory = statisticsFactory, groupName
= identifier), FunctionServiceStats, MicrometerStatsImplementer {
+ override fun initializeStaticMeters() {
+ }
+
+ override fun getFunctionExecutionsCompleted(): Int = 0
+
+ override fun incFunctionExecutionsCompleted() {
+
+ }
+
+ override fun getFunctionExecutionCompleteProcessingTime(): Long = 0
+
+ override fun getFunctionExecutionsRunning(): Int = 0
+
+ override fun incFunctionExecutionsRunning() {
+
+ }
+
+ override fun getResultsSentToResultCollector(): Int = 0
+
+ override fun incResultsReturned() {
+
+ }
+
+ override fun getResultsReceived(): Int = 0
+
+ override fun incResultsReceived() {
+
+ }
+
+ override fun getFunctionExecutionCalls(): Int = 0
+
+ override fun incFunctionExecutionCalls() {
+
+ }
+
+ override fun getFunctionExecutionHasResultCompleteProcessingTime(): Int = 0
+
+ override fun getFunctionExecutionHasResultRunning(): Int = 0
+
+ override fun incFunctionExecutionHasResultRunning() {
+
+ }
+
+ override fun getFunctionExecutionExceptions(): Int = 0
+
+ override fun incFunctionExecutionExceptions() {
+
+ }
+
+ override fun startTime(): Long = 0L
+
+ override fun startFunctionExecution(haveResult: Boolean) {
+
+ }
+
+ override fun endFunctionExecution(start: Long, haveResult: Boolean) {
+
+ }
+
+ override fun endFunctionExecutionWithException(haveResult: Boolean) {
+
+ }
+
+ override fun close() {
+
+ }
+
+ override fun getStats(): Statistics? = null
+
+}
\ No newline at end of file
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/function/MicrometerFunctionStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/function/MicrometerFunctionStats.kt
index f5a0bf9..2b89a22 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/function/MicrometerFunctionStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/function/MicrometerFunctionStats.kt
@@ -20,9 +20,10 @@ import
org.apache.geode.statistics.internal.micrometer.impl.CounterStatisticMete
import org.apache.geode.statistics.internal.micrometer.impl.GaugeStatisticMeter
import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
import org.apache.geode.statistics.util.NOW_NANOS
+import org.apache.geode.stats.common.statistics.factory.StatsFactory
import java.util.concurrent.ConcurrentHashMap
-class MicrometerFunctionStats(statisticsFactory: StatisticsFactory?, private
val functionName: String) :
+class MicrometerFunctionStats(statisticsFactory: StatisticsFactory, private
val functionName: String) :
MicrometerMeterGroup(statisticsFactory,
"FunctionStats-$functionName"), FunctionStats {
override fun getGroupTags(): Array<String> = arrayOf("functionId",
functionName)
@@ -47,7 +48,7 @@ class MicrometerFunctionStats(statisticsFactory:
StatisticsFactory?, private val
@JvmStatic
fun getFunctionStats(textId: String): MicrometerFunctionStats =
functionExecutionStatsMap[textId] ?: run {
- val functionStats =
MicrometerFunctionStats(statisticsFactory = null,functionName = textId)
+ val functionStats =
StatsFactory.createStatsImpl<MicrometerFunctionStats>(FunctionStats::class.java,
textId)
functionExecutionStatsMap[textId] = functionStats
functionStats
}
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/internal/micrometer/impl/MicrometerMeterGroup.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/internal/micrometer/impl/MicrometerMeterGroup.kt
index 44d2c28..27f08c0 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/internal/micrometer/impl/MicrometerMeterGroup.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/internal/micrometer/impl/MicrometerMeterGroup.kt
@@ -16,16 +16,18 @@ package org.apache.geode.statistics.internal.micrometer.impl
import io.micrometer.core.instrument.MeterRegistry
import io.micrometer.core.instrument.binder.MeterBinder
-import org.apache.geode.stats.common.statistics.StatisticsFactory
import org.apache.geode.statistics.internal.micrometer.StatisticsMeterGroup
import org.apache.geode.statistics.micrometer.MicrometerStatsImplementer
+import org.apache.geode.stats.common.statistics.StatisticsFactory
-abstract class MicrometerMeterGroup(private val statisticsFactory:
StatisticsFactory?, private val groupName: String) : StatisticsMeterGroup,
MeterBinder,
+abstract class MicrometerMeterGroup(private val statisticsFactory:
StatisticsFactory,private val groupName: String) : StatisticsMeterGroup,
MeterBinder,
MicrometerStatsImplementer {
- init{
+
+ override fun postConstruct(factory: StatisticsFactory) {
initializeImplementer(statisticsFactory)
registerStatsImplementer(statisticsFactory)
}
+
private val registeredMeters = mutableListOf<MicrometerStatisticMeter>()
private val registeredMeterGroups = mutableListOf<MicrometerMeterGroup>()
@@ -35,18 +37,18 @@ abstract class MicrometerMeterGroup(private val
statisticsFactory: StatisticsFac
open fun getGroupTags(): Array<String> = emptyArray()
- override fun registerStatsImplementer(factory: StatisticsFactory?) {
- MicrometerStatisticsManager.registerMeterGroup(this.groupName,this)
+ override fun registerStatsImplementer(factory: StatisticsFactory) {
+ MicrometerStatisticsManager.registerMeterGroup(this.groupName, this)
}
- override fun initializeImplementer(factory: StatisticsFactory?) {
+ final override fun initializeImplementer(factory: StatisticsFactory) {
initializeStaticMeters()
}
override fun getMeterGroupName(): String = groupName
override fun bindTo(registry: MeterRegistry) {
- registeredMeters.forEach {it.register(registry, commonGroupTags) }
+ registeredMeters.forEach { it.register(registry, commonGroupTags) }
registeredMeterGroups.forEach { micrometerMeterGroup ->
micrometerMeterGroup.registeredMeters.forEach { it.register(registry,
commonGroupTags) } }
}
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 f023864..3f280e5 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
@@ -93,13 +93,13 @@ object MicrometerStatisticsManager : StatisticsManager {
if (meterGroup is MicrometerMeterGroup) {
registeredMeterGroups.putIfAbsent(groupName, meterGroup)
?.run { println("MeterGroup: $groupName was already
registered") }
- if (!enableStats) {
- meterRegistry.config().meterFilter(object : MeterFilter {
- override fun accept(id: Meter.Id): MeterFilterReply {
- return MeterFilterReply.DENY
- }
- })
- }
+// if (!enableStats) {
+// meterRegistry.config().meterFilter(object : MeterFilter {
+// override fun accept(id: Meter.Id): MeterFilterReply {
+// return MeterFilterReply.DENY
+// }
+// })
+// }
meterGroup.bindTo(meterRegistry)
} else {
TODO("Register Non-MircometerMeterGrouops, this feature is not yet
supported. Most likely never will be")
@@ -115,7 +115,7 @@ object MicrometerStatisticsManager : StatisticsManager {
val compositeMeterRegistry = CompositeMeterRegistry(Clock.SYSTEM)
// compositeMeterRegistry.add(createInfluxDB())
// compositeMeterRegistry.add(createPrometheus())
-// compositeMeterRegistry.add(createJMX())
+ compositeMeterRegistry.add(createJMX())
return compositeMeterRegistry
}
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/locator/MicrometerLocatorStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/locator/MicrometerLocatorStats.kt
index 8872b7f..83a32e1 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/locator/MicrometerLocatorStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/locator/MicrometerLocatorStats.kt
@@ -23,7 +23,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.TimerStatisticMeter
import org.apache.geode.statistics.micrometer.MicrometerStatsImplementer
import org.apache.geode.statistics.util.NOW_NANOS
-class MicrometerLocatorStats(statisticsFactory: StatisticsFactory?, private
val locatorName: String) :
+class MicrometerLocatorStats(statisticsFactory: StatisticsFactory, private val
locatorName: String) :
MicrometerMeterGroup(statisticsFactory,"LocatorStats-$locatorName"),
LocatorStats, MicrometerStatsImplementer {
override fun getGroupTags(): Array<String> = arrayOf("locatorName",
locatorName)
@@ -48,7 +48,7 @@ class MicrometerLocatorStats(statisticsFactory:
StatisticsFactory?, private val
private val locatorClientResponseTimer =
TimerStatisticMeter("locator.response.time", "Time spent sending location
responses to clients", meterUnit = "nanoseconds")
private val locatorServerLoadUpdateMeter =
CounterStatisticMeter("locator.server.load.update.count", "Total number of
times a server load update has been received.")
- override fun hookupStats(f: StatisticsFactory?, name: String?) {
+ override fun hookupStats(name: String?) {
//noop
}
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 55e6a7b..96414fd 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
@@ -16,13 +16,14 @@ package org.apache.geode.statistics.micrometer
import io.micrometer.core.instrument.MeterRegistry
import io.micrometer.core.instrument.simple.SimpleMeterRegistry
+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.MicrometerStatisticsManager
import org.apache.geode.stats.common.statistics.StatisticDescriptor
import org.apache.geode.stats.common.statistics.Statistics
import org.apache.geode.stats.common.statistics.StatisticsFactory
import org.apache.geode.stats.common.statistics.StatisticsType
-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.MicrometerStatisticsManager
+import org.apache.geode.stats.common.statistics.factory.StatsFactory
import java.io.Reader
class MicrometerStatisticsFactoryImpl(vararg meterRegistries: MeterRegistry =
arrayOf(SimpleMeterRegistry())) : StatisticsFactory {
@@ -33,7 +34,7 @@ class MicrometerStatisticsFactoryImpl(vararg meterRegistries:
MeterRegistry = ar
override fun getType(): String = "Micrometer"
- override fun createOsStatistics(type: StatisticsType?, textId: String,
numericId: Long, osStatFlags: Int): Statistics =
+ 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 {
@@ -95,7 +96,7 @@ class MicrometerStatisticsFactoryImpl(vararg meterRegistries:
MeterRegistry = ar
override fun createDoubleGauge(name: String, description: String, units:
String, largerBetter: Boolean) = createIntGauge(name, description, units)
override fun createType(name: String, description: String, stats:
Array<StatisticDescriptor>): StatisticsType {
- val micrometerStatisticsType = MicrometerStatisticsType(name,
description, stats)
+ val micrometerStatisticsType = MicrometerStatisticsType(name,
description, stats, StatsFactory.getStatisticsFactory())
micrometerStatisticsManager.registerMeterGroup(name,
micrometerStatisticsType)
meterGroupMap[name] = micrometerStatisticsType
return micrometerStatisticsType
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 0aca99d..8b46db1 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
@@ -14,22 +14,24 @@
*/
package org.apache.geode.statistics.micrometer
-import org.apache.geode.stats.common.statistics.StatisticDescriptor
-import org.apache.geode.stats.common.statistics.StatisticsType
import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerStatisticMeter
+import org.apache.geode.stats.common.statistics.StatisticDescriptor
+import org.apache.geode.stats.common.statistics.StatisticsFactory
+import org.apache.geode.stats.common.statistics.StatisticsType
class MicrometerStatisticsType(private val name: String,
private val description: String,
- private val statistics:
Array<StatisticDescriptor>) :
- StatisticsType, MicrometerMeterGroup(statisticsFactory =
null,groupName = name) {
+ private val statistics:
Array<StatisticDescriptor>,
+ private val statisticsFactory:
StatisticsFactory) :
+ StatisticsType, MicrometerMeterGroup(statisticsFactory =
statisticsFactory, groupName = name) {
override fun initializeStaticMeters() {
//noop
}
private val statsArray: Array<StatisticDescriptor> = statistics
-// private val statsIdToNameMap = hashMapOf<Int, String>()
+ // private val statsIdToNameMap = hashMapOf<Int, String>()
private val statsNameToIdMap = hashMapOf<String, Int>()
init {
@@ -37,7 +39,6 @@ class MicrometerStatisticsType(private val name: String,
run {
statisticDescriptor as MicrometerStatisticMeter
statisticDescriptor.meterId = index
-// statsIdToNameMap[index] = statisticDescriptor.name
statsNameToIdMap[statisticDescriptor.name] = index
registerMeter(statisticDescriptor)
}
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/offheap/MicrometerOffHeapStorageStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/offheap/MicrometerOffHeapStorageStats.kt
index 2336346..a70b9a8 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/offheap/MicrometerOffHeapStorageStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/offheap/MicrometerOffHeapStorageStats.kt
@@ -22,7 +22,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.GaugeStatisticMeter
import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
import org.apache.geode.statistics.util.NOW_NANOS
-class MicrometerOffHeapStorageStats(statisticsFactory: StatisticsFactory?,
private val name: String) :
+class MicrometerOffHeapStorageStats(statisticsFactory: StatisticsFactory,
private val name: String) :
MicrometerMeterGroup(statisticsFactory, "OffHeapMemoryStats-$name"),
OffHeapStorageStats {
override fun getGroupTags(): Array<String> = arrayOf("offheap", name)
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/query/MicrometerCqQueryVsdStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/query/MicrometerCqQueryVsdStats.kt
index 1384a64..6a41cf2 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/query/MicrometerCqQueryVsdStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/query/MicrometerCqQueryVsdStats.kt
@@ -20,7 +20,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.CounterStatisticMete
import org.apache.geode.statistics.internal.micrometer.impl.GaugeStatisticMeter
import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
-class MicrometerCqQueryVsdStats(statisticsFactory: StatisticsFactory?, private
val cqName: String) :
+class MicrometerCqQueryVsdStats(statisticsFactory: StatisticsFactory, private
val cqName: String) :
MicrometerMeterGroup(statisticsFactory,"CqQueryStats-$cqName"),
CqQueryVsdStats {
override fun getGroupTags(): Array<String> = arrayOf("cqName", cqName)
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/query/MicrometerCqServiceVsdStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/query/MicrometerCqServiceVsdStats.kt
index 80f7092..200f029 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/query/MicrometerCqServiceVsdStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/query/MicrometerCqServiceVsdStats.kt
@@ -22,12 +22,10 @@ import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
import org.apache.geode.statistics.micrometer.MicrometerStatsImplementer
import org.apache.geode.statistics.util.NOW_NANOS
-class MicrometerCqServiceVsdStats() :
- MicrometerMeterGroup(statisticsFactory = null, groupName =
"CqServiceStats"),
+class MicrometerCqServiceVsdStats(statisticsFactory: StatisticsFactory,
identifier: String) :
+ MicrometerMeterGroup(statisticsFactory= statisticsFactory,groupName =
"CqServiceStats"),
CqServiceVsdStats,MicrometerStatsImplementer {
- constructor(statisticsFactory: StatisticsFactory?, identifier: String?) :
this()
-
private val cqNumberCQsCreatedMeter = GaugeStatisticMeter("cq.count",
"Number of CQs created")
private val cqNumberCQsActiveMeter = GaugeStatisticMeter("cq.count",
"Number of CQS actively executing.", arrayOf("state", "active"))
private val cqNumberCQsStoppedMeter = GaugeStatisticMeter("cq.count",
"Number of CQs stopped.", arrayOf("state", "stopped"))
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/region/MicrometerHARegionQueueStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/region/MicrometerHARegionQueueStats.kt
index af2fecd..a405b3a 100755
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/region/MicrometerHARegionQueueStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/region/MicrometerHARegionQueueStats.kt
@@ -19,7 +19,7 @@ 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.MicrometerMeterGroup
-class MicrometerHARegionQueueStats(statisticsFactory: StatisticsFactory?,
private val queueName: String) :
+class MicrometerHARegionQueueStats(statisticsFactory: StatisticsFactory,
private val queueName: String) :
MicrometerMeterGroup(statisticsFactory,"ClientSubscriptionStats-$queueName"),
HARegionQueueStats {
override fun getGroupTags(): Array<String> = arrayOf("queueName",
queueName)
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/region/MicrometerPartitionedRegionStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/region/MicrometerPartitionedRegionStats.kt
index 52195cd..9ec2afd 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/region/MicrometerPartitionedRegionStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/region/MicrometerPartitionedRegionStats.kt
@@ -24,7 +24,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
import org.apache.geode.statistics.internal.micrometer.impl.TimerStatisticMeter
import org.apache.geode.statistics.util.NOW_NANOS
-class MicrometerPartitionedRegionStats(statisticsFactory: StatisticsFactory?,
private val regionName: String) :
+class MicrometerPartitionedRegionStats(statisticsFactory: StatisticsFactory,
private val regionName: String) :
MicrometerMeterGroup(statisticsFactory,
"PartitionRegionStats-$regionName"), PartitionedRegionStats {
override fun getGroupTags(): Array<String> = arrayOf("regionName",
regionName)
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/region/MicrometerRegionPerfStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/region/MicrometerRegionPerfStats.kt
index 051fd95..171f5f7 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/region/MicrometerRegionPerfStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/region/MicrometerRegionPerfStats.kt
@@ -19,7 +19,7 @@ import
org.apache.geode.stats.common.internal.cache.RegionPerfStats
import org.apache.geode.stats.common.statistics.StatisticsFactory
import org.apache.geode.statistics.cache.MicrometerCachePerfStats
-class MicrometerRegionPerfStats(statisticsFactory: StatisticsFactory?, private
var cachePerfStats: CachePerfStats, private val regionName: String) :
+class MicrometerRegionPerfStats(statisticsFactory: StatisticsFactory, private
var cachePerfStats: CachePerfStats, private val regionName: String) :
MicrometerCachePerfStats(statisticsFactory, regionName),
RegionPerfStats {
override fun incReliableQueuedOps(inc: Int) {
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/resourcemanger/MicrometerResourceManagerStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/resourcemanger/MicrometerResourceManagerStats.kt
index 1ba7ebe..3d0211f 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/resourcemanger/MicrometerResourceManagerStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/resourcemanger/MicrometerResourceManagerStats.kt
@@ -14,21 +14,19 @@
*/
package org.apache.geode.statistics.resourcemanger
-import org.apache.geode.stats.common.distributed.internal.PoolStatHelper
-import org.apache.geode.stats.common.distributed.internal.QueueStatHelper
-import
org.apache.geode.stats.common.internal.cache.control.ResourceManagerStats
-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.distributed.internal.PoolStatHelper
+import org.apache.geode.stats.common.distributed.internal.QueueStatHelper
+import
org.apache.geode.stats.common.internal.cache.control.ResourceManagerStats
+import org.apache.geode.stats.common.statistics.StatisticsFactory
-class MicrometerResourceManagerStats() :
- MicrometerMeterGroup(statisticsFactory = null,groupName =
"ResourceManagerStats"), ResourceManagerStats, MicrometerStatsImplementer {
-
- constructor(statisticsFactory: StatisticsFactory, name: String?): this()
+class MicrometerResourceManagerStats(statisticsFactory: StatisticsFactory,
name: String) :
+ MicrometerMeterGroup(statisticsFactory = statisticsFactory, groupName
= "ResourceManagerStats"), ResourceManagerStats, MicrometerStatsImplementer {
private val resourceRebalanceInProgressMeter =
GaugeStatisticMeter("manager.resources.rebalance.inprogress.count", "Current
number of cache rebalance operations being directed by this process.")
private val resourceRebalanceCompletedMeter =
CounterStatisticMeter("manager.resources.rebalance.completed.count", "Total
number of cache rebalance operations directed by this process.")
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/wan/MicrometerAsyncEventQueueStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/wan/MicrometerAsyncEventQueueStats.kt
index 712c3f9..2ba01d9 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/wan/MicrometerAsyncEventQueueStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/wan/MicrometerAsyncEventQueueStats.kt
@@ -16,7 +16,7 @@ package org.apache.geode.statistics.wan
import org.apache.geode.stats.common.statistics.StatisticsFactory
-class MicrometerAsyncEventQueueStats(statisticsFactory: StatisticsFactory?,
private val asyncQueueName: String) :
+class MicrometerAsyncEventQueueStats(statisticsFactory: StatisticsFactory,
private val asyncQueueName: String) :
MicrometerGatewaySenderStats(statisticsFactory,asyncQueueName,
"AsyncQueueStats-$asyncQueueName") {
diff --git
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/wan/MicrometerGatewayReceiverStats.kt
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/wan/MicrometerGatewayReceiverStats.kt
index a41a871..8f432dc 100644
---
a/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/wan/MicrometerGatewayReceiverStats.kt
+++
b/geode-micrometer-stats/src/main/kotlin/org/apache/geode/statistics/wan/MicrometerGatewayReceiverStats.kt
@@ -20,7 +20,7 @@ import
org.apache.geode.statistics.cache.MicrometerCacheServerStats
import
org.apache.geode.statistics.internal.micrometer.impl.CounterStatisticMeter
//By inheritence this is a MicrometerMeterGroup
-class MicrometerGatewayReceiverStats(statisticsFactory: StatisticsFactory?,
private val owner: String) :
+class MicrometerGatewayReceiverStats(statisticsFactory: StatisticsFactory,
private val owner: String) :
MicrometerCacheServerStats(statisticsFactory, owner,
"GatewayReceiverStats-$owner"), GatewayReceiverStats {
override fun getGroupTags(): Array<String> = arrayOf("owner", owner)
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 612ccab..0b75938 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
@@ -23,7 +23,7 @@ import
org.apache.geode.statistics.internal.micrometer.impl.MicrometerMeterGroup
import org.apache.geode.statistics.internal.micrometer.impl.TimerStatisticMeter
import org.apache.geode.statistics.util.NOW_NANOS
-open class MicrometerGatewaySenderStats @JvmOverloads
constructor(statisticsFactory: StatisticsFactory?, private val queueName:
String, private val groupName: String = "GatewayReceiverStats-$queueName") :
+open class MicrometerGatewaySenderStats @JvmOverloads
constructor(statisticsFactory: StatisticsFactory, private val queueName:
String, private val groupName: String = "GatewayReceiverStats-$queueName") :
MicrometerMeterGroup(statisticsFactory, groupName), GatewaySenderStats
{
diff --git
a/geode-stats-common/src/main/java/org/apache/geode/internal/cache/execute/FunctionServiceStats.java
b/geode-stats-common/src/main/java/org/apache/geode/internal/cache/execute/FunctionServiceStats.java
new file mode 100644
index 0000000..fb0e377
--- /dev/null
+++
b/geode-stats-common/src/main/java/org/apache/geode/internal/cache/execute/FunctionServiceStats.java
@@ -0,0 +1,64 @@
+/*
+ * 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.cache.execute;
+
+import org.apache.geode.stats.common.Stats;
+import org.apache.geode.stats.common.statistics.Statistics;
+
+public interface FunctionServiceStats extends Stats {
+ int getFunctionExecutionsCompleted();
+
+ void incFunctionExecutionsCompleted();
+
+ long getFunctionExecutionCompleteProcessingTime();
+
+ int getFunctionExecutionsRunning();
+
+ void incFunctionExecutionsRunning();
+
+ int getResultsSentToResultCollector();
+
+ void incResultsReturned();
+
+ int getResultsReceived();
+
+ void incResultsReceived();
+
+ int getFunctionExecutionCalls();
+
+ void incFunctionExecutionCalls();
+
+ int getFunctionExecutionHasResultCompleteProcessingTime();
+
+ int getFunctionExecutionHasResultRunning();
+
+ void incFunctionExecutionHasResultRunning();
+
+ int getFunctionExecutionExceptions();
+
+ void incFunctionExecutionExceptions();
+
+ long startTime();
+
+ void startFunctionExecution(boolean haveResult);
+
+ void endFunctionExecution(long start, boolean haveResult);
+
+ void endFunctionExecutionWithException(boolean haveResult);
+
+ void close();
+
+ Statistics getStats();
+}
diff --git
a/geode-stats-common/src/main/java/org/apache/geode/stats/common/distributed/internal/LocatorStats.java
b/geode-stats-common/src/main/java/org/apache/geode/stats/common/distributed/internal/LocatorStats.java
index 38ad08d..d76bbc4 100644
---
a/geode-stats-common/src/main/java/org/apache/geode/stats/common/distributed/internal/LocatorStats.java
+++
b/geode-stats-common/src/main/java/org/apache/geode/stats/common/distributed/internal/LocatorStats.java
@@ -19,7 +19,7 @@ import
org.apache.geode.stats.common.statistics.StatisticsFactory;
public interface LocatorStats extends Stats {
- void hookupStats(StatisticsFactory f, String name);
+ void hookupStats(String name);
void setServerCount(int sc);
diff --git
a/geode-stats-common/src/main/java/org/apache/geode/stats/common/statistics/GFSStatsImplementer.java
b/geode-stats-common/src/main/java/org/apache/geode/stats/common/statistics/GFSStatsImplementer.java
index 5e3e5ef..0dddae4 100644
---
a/geode-stats-common/src/main/java/org/apache/geode/stats/common/statistics/GFSStatsImplementer.java
+++
b/geode-stats-common/src/main/java/org/apache/geode/stats/common/statistics/GFSStatsImplementer.java
@@ -29,4 +29,9 @@ public interface GFSStatsImplementer extends StatsImplementer
{
@Override
default void registerStatsImplementer(StatisticsFactory factory) {}
+
+ @Override
+ default void postConstruct(StatisticsFactory factory) {
+ initializeImplementer(factory);
+ }
}
diff --git
a/geode-stats-common/src/main/java/org/apache/geode/stats/common/statistics/StatsImplementer.java
b/geode-stats-common/src/main/java/org/apache/geode/stats/common/statistics/StatsImplementer.java
index ce6cf82..67ad856 100644
---
a/geode-stats-common/src/main/java/org/apache/geode/stats/common/statistics/StatsImplementer.java
+++
b/geode-stats-common/src/main/java/org/apache/geode/stats/common/statistics/StatsImplementer.java
@@ -20,4 +20,6 @@ public interface StatsImplementer {
void initializeImplementer(StatisticsFactory factory);
void registerStatsImplementer(StatisticsFactory factory);
+
+ void postConstruct(StatisticsFactory factory);
}
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 560269f..0bb6c61 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
@@ -33,6 +33,8 @@ import
org.apache.geode.stats.common.cache.client.internal.ConnectionStats;
import org.apache.geode.stats.common.internal.cache.CachePerfStats;
import org.apache.geode.stats.common.internal.cache.PoolStats;
import org.apache.geode.stats.common.internal.cache.RegionPerfStats;
+import
org.apache.geode.stats.common.internal.cache.tier.sockets.CacheServerStats;
+import org.apache.geode.stats.common.internal.cache.wan.GatewayReceiverStats;
import org.apache.geode.stats.common.statistics.GFSStatsImplementer;
import org.apache.geode.stats.common.statistics.StatisticsFactory;
import org.apache.geode.stats.common.statistics.StatsImplementer;
@@ -41,7 +43,7 @@ public class StatsFactory {
private static final boolean isExperimentalEnabled =
Boolean.getBoolean("geode.experimental.stats.micrometer");
- private static final StatsFactory statsFactory =
+ private static final StatsFactory singletonStatsFactory =
new StatsFactory(getStatsImplementor(), getStatisticsTypeFactory());
private final Class<? extends StatsImplementer> selectedStatsImplementor;
private final Map<Class<?>, Class<? extends StatsImplementer>>
resolvedStatsImplForClass =
@@ -49,7 +51,7 @@ public class StatsFactory {
private final StatisticsFactory statisticsFactory;
private StatsFactory(Class<? extends StatsImplementer>
selectedStatsImplementor,
- StatisticsFactory statisticsFactory) {
+ StatisticsFactory statisticsFactory) {
List<ClassLoader> classLoadersList = new LinkedList<>();
classLoadersList.add(ClasspathHelper.contextClassLoader());
classLoadersList.add(ClasspathHelper.staticClassLoader());
@@ -70,7 +72,7 @@ public class StatsFactory {
try {
return isExperimentalEnabled
? (Class<? extends StatsImplementer>) Class
-
.forName("org.apache.geode.statistics.micrometer.MicrometerStatsImplementer")
+
.forName("org.apache.geode.statistics.micrometer.MicrometerStatsImplementer")
: GFSStatsImplementer.class;
} catch (ClassNotFoundException e) {
e.printStackTrace();
@@ -81,8 +83,10 @@ public class StatsFactory {
private static StatisticsFactory getStatisticsTypeFactory() {
final ServiceLoader<StatisticsFactory> services =
ServiceLoader.load(StatisticsFactory.class);
for (StatisticsFactory statisticsFactory : services) {
- if (isExperimentalEnabled &&
statisticsFactory.getType().equals("Micrometer")) {
- return statisticsFactory;
+ if (isExperimentalEnabled) {
+ if (statisticsFactory.getType().equals("Micrometer")) {
+ return statisticsFactory;
+ }
} else if (statisticsFactory.getType().equals("GeodeStats")) {
return statisticsFactory;
}
@@ -92,7 +96,7 @@ public class StatsFactory {
}
public static <V extends StatsImplementer> V createStatsImpl(Class<?>
interfaceClazz,
- String identifier) {
+ String
identifier) {
return (V) resolveInstanceFromClass(interfaceClazz, identifier);
}
@@ -106,26 +110,29 @@ public class StatsFactory {
}
private static StatsImplementer resolveInstanceFromClass(Class<?>
interfaceClazz, String name) {
- return statsFactory.createInstanceFromClass(interfaceClazz, name);
+ return singletonStatsFactory.createInstanceFromClass(interfaceClazz, name);
}
private static StatsImplementer resolveCachePerfInstanceFromClass(String
name) {
- return statsFactory.createInstanceFromClass(CachePerfStats.class, name);
+ return singletonStatsFactory.createInstanceFromClass(CachePerfStats.class,
name);
}
private static StatsImplementer
resolveConnectionStatInstanceFromClass(String name,
- PoolStats poolStats) {
- return statsFactory.createConnectionStatInstanceFromClass(name, poolStats);
+
PoolStats poolStats) {
+ return singletonStatsFactory.createConnectionStatInstanceFromClass(name,
poolStats);
}
public static RegionPerfStats createRegionPerfStatsImplFromClass(Class<?>
interfaceClazz,
- CachePerfStats cachePerfStats, String regionName) {
+
CachePerfStats cachePerfStats,
+ String
regionName) {
try {
Class<? extends StatsImplementer> resolvedLocatorClassImpl =
- statsFactory.resolvedStatsImplForClass.get(interfaceClazz);
- return (RegionPerfStats) resolvedLocatorClassImpl
+ singletonStatsFactory.resolvedStatsImplForClass.get(interfaceClazz);
+ final StatsImplementer statsImplementer = resolvedLocatorClassImpl
.getDeclaredConstructor(StatisticsFactory.class,
CachePerfStats.class, String.class)
- .newInstance(statsFactory.getFactory(), cachePerfStats, regionName);
+ .newInstance(singletonStatsFactory.getFactory(), cachePerfStats,
regionName);
+ statsImplementer.postConstruct(getStatisticsFactory());
+ return (RegionPerfStats) statsImplementer;
} catch (InstantiationException | IllegalAccessException |
NoSuchMethodException
| InvocationTargetException e) {
e.printStackTrace();
@@ -134,11 +141,11 @@ public class StatsFactory {
}
public static boolean isLegacyGeodeStats() {
- return statsFactory.getFactory().getType().equals("GeodeStats");
+ return singletonStatsFactory.getFactory().getType().equals("GeodeStats");
}
public static StatisticsFactory getStatisticsFactory() {
- return statsFactory.statisticsFactory;
+ return singletonStatsFactory.statisticsFactory;
}
private StatisticsFactory getFactory() {
@@ -158,19 +165,27 @@ public class StatsFactory {
reflections.getSubTypesOf(CachePerfStats.class).stream()
.filter(clazz -> selectedStatsImplementor.isAssignableFrom(clazz)
&& !RegionPerfStats.class.isAssignableFrom(clazz) &&
!clazz.getName()
- .contains("DummyCachePerfStats"))
+ .contains("DummyCachePerfStats"))
.forEach(aClass -> resolvedStatsImplForClass
.put(CachePerfStats.class, (Class<? extends StatsImplementer>)
aClass));
+
+ reflections.getSubTypesOf(CacheServerStats.class).stream()
+ .filter(clazz -> selectedStatsImplementor.isAssignableFrom(clazz)
+ && !GatewayReceiverStats.class.isAssignableFrom(clazz))
+ .forEach(aClass -> resolvedStatsImplForClass
+ .put(CacheServerStats.class, (Class<? extends StatsImplementer>)
aClass));
}
private StatsImplementer createConnectionStatInstanceFromClass(String
locatorName,
- PoolStats poolStats) {
+ PoolStats
poolStats) {
try {
Class<? extends StatsImplementer> resolvedLocatorClassImpl =
resolveImplementationForClass(ConnectionStats.class);
- return resolvedLocatorClassImpl
+ final StatsImplementer statsImplementer = resolvedLocatorClassImpl
.getDeclaredConstructor(StatisticsFactory.class, String.class,
PoolStats.class)
.newInstance(statisticsFactory, locatorName, poolStats);
+ statsImplementer.postConstruct(statisticsFactory);
+ return statsImplementer;
} catch (InstantiationException | IllegalAccessException |
NoSuchMethodException
| InvocationTargetException e) {
e.printStackTrace();
@@ -192,9 +207,11 @@ public class StatsFactory {
try {
Class<? extends StatsImplementer> resolvedLocatorClassImpl =
resolveImplementationForClass(interfaceClazz);
- return resolvedLocatorClassImpl
+ final StatsImplementer statsImplementer = resolvedLocatorClassImpl
.getDeclaredConstructor(StatisticsFactory.class, String.class)
.newInstance(statisticsFactory, name);
+ statsImplementer.postConstruct(statisticsFactory);
+ return statsImplementer;
} catch (InstantiationException | IllegalAccessException |
NoSuchMethodException
| InvocationTargetException e) {
e.printStackTrace();