DonalEvans commented on a change in pull request #7363:
URL: https://github.com/apache/geode/pull/7363#discussion_r806271995



##########
File path: 
geode-for-redis/src/main/java/org/apache/geode/redis/internal/GeodeRedisServer.java
##########
@@ -110,23 +108,7 @@ private static RedisStats createStats(InternalCache cache, 
String bindAddress, i
         StatisticsClockFactory.clock(true);
 
     return new RedisStats(statisticsClock,
-        new GeodeRedisStats(system.getStatisticsManager(), 
getServerName(bindAddress, port),
-            statisticsClock));
-  }
-
-  private static String getServerName(String bindAddress, int port) {
-    String name = "geodeForRedis:";
-    if (bindAddress != null && !bindAddress.isEmpty()) {
-      name += bindAddress;
-    } else {
-      try {
-        name += LocalHostUtil.getCanonicalLocalHostName();
-      } catch (UnknownHostException e) {
-        name += "*.*.*.*";
-      }
-    }
-    name += ':' + port;
-    return name;
+        new GeodeRedisStats(system.getStatisticsManager(), statisticsClock));

Review comment:
       With these changes, the `bindAddress` and `port` arguments in the 
`createStats()` method are not used and can be removed.

##########
File path: 
geode-for-redis/src/integrationTest/java/org/apache/geode/redis/internal/statistics/GeodeRedisStatsIntegrationTest.java
##########
@@ -0,0 +1,57 @@
+/*
+ * 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.redis.internal.statistics;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.junit.ClassRule;
+import org.junit.Test;
+
+import org.apache.geode.Statistics;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.internal.statistics.StatisticsManager;
+import org.apache.geode.redis.GeodeRedisServerRule;
+import org.apache.geode.redis.internal.commands.RedisCommandType;
+
+public class GeodeRedisStatsIntegrationTest {
+
+  @ClassRule
+  public static GeodeRedisServerRule server = new GeodeRedisServerRule();
+
+  @Test
+  public void checkGeodeRedisStatsExist() {
+    Cache cache = CacheFactory.getAnyInstance();
+    InternalDistributedSystem internalSystem =
+        (InternalDistributedSystem) cache.getDistributedSystem();
+    StatisticsManager statisticsManager = 
internalSystem.getStatisticsManager();
+
+    List<String> statDescriptions = statisticsManager.getStatsList()
+        .stream().map(Statistics::getTextId).collect(Collectors.toList());
+
+    assertThat(statDescriptions).contains(GeodeRedisStats.STATS_BASENAME);
+
+    for (RedisCommandType.Category category : 
RedisCommandType.Category.values()) {
+      String name = GeodeRedisStats.STATS_BASENAME + ":" + category.name();
+      assertThat(statDescriptions).contains(name);
+    }

Review comment:
       Should this test also check for the presence of the "general" stat 
category?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to