Skip to content

Commit

Permalink
Print more info for client stats
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-ai committed Mar 17, 2023
1 parent c4d4ce6 commit 514056c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import org.apache.rocketmq.client.java.misc.ExecutorServices;
import org.apache.rocketmq.client.java.misc.MetadataUtils;
import org.apache.rocketmq.client.java.misc.ThreadFactoryImpl;
import org.apache.rocketmq.client.java.misc.Utilities;
import org.apache.rocketmq.client.java.route.Endpoints;
import org.apache.rocketmq.client.java.rpc.Context;
import org.apache.rocketmq.client.java.rpc.RpcClient;
Expand Down Expand Up @@ -394,8 +395,9 @@ protected void startUp() {
() -> {
try {
log.info("Start to log statistics, clientVersion={}, clientWrapperVersion={}, "
+ "clientEndpoints={}, clientId={}", MetadataUtils.getVersion(),
MetadataUtils.getWrapperVersion(), client.getEndpoints(), clientId);
+ "clientEndpoints={}, os description=[{}], java description=[{}], clientId={}",
MetadataUtils.getVersion(), MetadataUtils.getWrapperVersion(), client.getEndpoints(),
Utilities.getOsDescription(), Utilities.getJavaDescription(), clientId);
client.doStats();
} catch (Throwable t) {
log.error("Exception raised during statistics logging, clientId={}", clientId, t);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,10 @@ public static String getOsVersion() {
return null;
}
}

public static String getJavaDescription() {
return System.getProperty("java.vm.vendor")
+ " " + System.getProperty("java.vm.name")
+ " " + System.getProperty("java.vm.version");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,10 @@ public void testStackTrace() {
assertNotNull(stackTrace);
assertTrue(stackTrace.length() > 0);
}

@Test
public void testGetJavaDescription() {
final String javaDescription = Utilities.getJavaDescription();
assertNotNull(javaDescription);
}
}

0 comments on commit 514056c

Please sign in to comment.