[ 
https://issues.apache.org/jira/browse/GEODE-8663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17223144#comment-17223144
 ] 

ASF GitHub Bot commented on GEODE-8663:
---------------------------------------

jhutchison commented on a change in pull request #5678:
URL: https://github.com/apache/geode/pull/5678#discussion_r514492081



##########
File path: 
geode-redis/src/main/java/org/apache/geode/redis/internal/executor/server/InfoExecutor.java
##########
@@ -72,26 +78,91 @@ private String getSpecifiedSection(ExecutionHandlerContext 
context,
   private String getServerSection(ExecutionHandlerContext context) {
     final String CURRENT_REDIS_VERSION = "5.0.6";
     final int TCP_PORT = context.getServerPort();
+    final RedisStats redisStats = context.getRedisStats();
     final String SERVER_STRING =
         "# Server\r\n" +
             "redis_version:" + CURRENT_REDIS_VERSION + "\r\n" +
             "redis_mode:standalone\r\n" +
-            "tcp_port:" + TCP_PORT + "\r\n";
+            "tcp_port:" + TCP_PORT + "\r\n" +
+            "uptime_in_seconds:" + redisStats.getUptimeInSeconds() + "\r\n" +
+            "uptime_in_days:" + redisStats.getUptimeInDays() + "\r\n";
     return SERVER_STRING;
   }
 
+  private String getClientsSection(ExecutionHandlerContext context) {
+    final RedisStats redisStats = context.getRedisStats();
+    final String CLIENTS_STRING =
+        "# Clients\r\n" +
+            "connected_clients:" + redisStats.getConnectedClients() + "\r\n" +
+            "blocked_clients:0\r\n";
+    return CLIENTS_STRING;
+  }
+
+  private String getMemorySection(ExecutionHandlerContext context) {
+    PartitionedRegion pr = (PartitionedRegion) 
context.getRegionProvider().getDataRegion();
+    long usedMemory = pr.getDataStore().currentAllocatedMemory();
+    final String MEMORY_STRING =
+        "# Memory\r\n" +
+            "used_memory:" + usedMemory + "\r\n" +
+            "mem_fragmentation_ratio:0\r\n";
+    return MEMORY_STRING;
+  }
+
+  private String getStatsSection(ExecutionHandlerContext context) {
+    final RedisStats redisStats = context.getRedisStats();
+    String instantaneous_input_kbps =
+        new DecimalFormat("0.00")
+            .format(redisStats.getNetworkKilobytesReadPerSecond());
+    final String STATS_STRING =
+        "# Stats\r\n" +
+            "total_commands_processed:" + redisStats.getCommandsProcessed() + 
"\r\n" +
+            "instantaneous_ops_per_sec:" + redisStats.getOpsPerSecond() + 
"\r\n" +
+            "total_net_input_bytes:" + redisStats.getNetworkBytesRead() + 
"\r\n" +
+            "instantaneous_input_kbps:" + instantaneous_input_kbps + "\r\n" +
+            "total_connections_received:" + 
redisStats.getConnectionsReceived() + "\r\n" +
+            "keyspace_hits:" + redisStats.getKeyspaceHits() + "\r\n" +
+            "keyspace_misses:" + redisStats.getKeyspaceMisses() + "\r\n" +
+            "evicted_keys:0\r\n" +
+            "rejected_connections:0\r\n";
+    return STATS_STRING;
+  }
+
+  private String getKeyspaceSection(ExecutionHandlerContext context) {
+    final RedisStats redisStats = context.getRedisStats();
+    final String KEYSPACE_STRING =
+        "# Keyspace\r\n" +
+            "db0:keys=" + context.getRegionProvider().getDataRegion().size() +
+            ",expires=" + redisStats.getExpirations() +
+            ",avg_ttl=0\r\n";

Review comment:
        story made for this 




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> update Redis Info command To include additional statistics
> ----------------------------------------------------------
>
>                 Key: GEODE-8663
>                 URL: https://issues.apache.org/jira/browse/GEODE-8663
>             Project: Geode
>          Issue Type: Improvement
>          Components: redis
>            Reporter: John Hutchison
>            Priority: Major
>              Labels: pull-request-available
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to