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 41090ea  More small changes
41090ea is described below

commit 41090eaf5375ed93a35a80e1c2c7de0e34879554
Author: Udo Kohlmeyer <[email protected]>
AuthorDate: Tue Sep 11 10:37:30 2018 -0700

    More small changes
---
 .../geode/internal/statistics/InternalDistributedSystemStats.java | 7 +++++--
 .../geode/stats/common/statistics/factory/StatsFactory.java       | 8 ++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

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 9452512..62a5031 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
@@ -22,6 +22,7 @@ import 
org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.internal.cache.execute.FunctionServiceStats;
 import org.apache.geode.statistics.micrometer.MicrometerStatisticsFactoryImpl;
 import org.apache.geode.stats.common.internal.cache.execute.FunctionStats;
+import org.apache.geode.stats.common.statistics.StatisticsFactory;
 import org.apache.geode.stats.common.statistics.factory.StatsFactory;
 
 public class InternalDistributedSystemStats {
@@ -41,6 +42,8 @@ public class InternalDistributedSystemStats {
   private FunctionServiceStats functionServiceStats;
   private boolean statsDisabled;
 
+  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
@@ -51,7 +54,7 @@ public class InternalDistributedSystemStats {
     this.statsDisabled = statsDisabled;
     this.functionServiceStats =
         StatsFactory.createStatsImpl(FunctionServiceStats.class, 
"FunctionExecution");
-    if (!statsDisabled && !(statisticsTypeFactory instanceof 
MicrometerStatisticsFactoryImpl)) {
+    if (!statsDisabled && StatsFactory.isLegacyGeodeStats()) {
       this.sampler = new GemFireStatSampler(internalDistributedSystem.getId(), 
distributionConfig,
           internalDistributedSystem.getCancelCriterion(), this,
           internalDistributedSystem.getDistributionManager());
@@ -67,7 +70,7 @@ public class InternalDistributedSystemStats {
     singleton.statsDisabled = statsDisabled;
     singleton.functionServiceStats =
         StatsFactory.createStatsImpl(FunctionServiceStats.class, 
"FunctionExecution");
-    if (!statsDisabled && !(statisticsTypeFactory instanceof 
MicrometerStatisticsFactoryImpl)) {
+    if (!statsDisabled && StatsFactory.isLegacyGeodeStats()) {
       singleton.sampler = new GemFireStatSampler(distributedSystem.getId(), 
distributionConfig,
           distributedSystem.getCancelCriterion(), singleton,
           distributedSystem.getDistributionManager());
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 04aa928..cbbfb93 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
@@ -133,6 +133,14 @@ public class StatsFactory {
     return null;
   }
 
+  public static boolean isLegacyGeodeStats() {
+    return statsFactory.getStatisticsFactory().getType().equals("GeodeStats");
+  }
+
+  public static StatisticsFactory getStatisticsFactory() {
+    return statsFactory.statisticsFactory;
+  }
+
   private StatisticsFactory getStatisticsFactory() {
     return statisticsFactory;
   }

Reply via email to