adoroszlai commented on code in PR #6500:
URL: https://github.com/apache/ozone/pull/6500#discussion_r1573280367


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/events/EventQueue.java:
##########
@@ -204,12 +187,22 @@ public <PAYLOAD, EVENT_TYPE extends Event<PAYLOAD>> void 
fireEvent(
 
         for (EventHandler handler : executorAndHandlers.getValue()) {
           queuedCount.incrementAndGet();
-          if (LOG.isTraceEnabled()) {
+          String jsonPayload = null;
+
+          try {
+            jsonPayload = serializeObject(payload);

Review Comment:
   This serializes the JSON even if log level is neither debug nor trace.



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/events/EventQueue.java:
##########
@@ -79,17 +70,13 @@ public EventQueue(String threadNamePrefix) {
   // The field parent in DatanodeDetails class has the circular reference
   // which will result in Gson infinite recursive parsing. We need to exclude
   // this field when generating json string for DatanodeDetails object
-  static class DatanodeDetailsGsonExclusionStrategy
-          implements ExclusionStrategy {
-    @Override
-    public boolean shouldSkipField(FieldAttributes f) {
-      return f.getDeclaringClass() == NodeImpl.class
-              && f.getName().equals("parent");
-    }
-
-    @Override
-    public boolean shouldSkipClass(Class<?> aClass) {
-      return false;
+  public String serializeObject(Object obj) {
+    try {
+      return JsonUtils.toJsonString(obj);
+    } catch (Exception e) {
+      // Handle the exception, maybe log it
+      LOG.error("Error serializing object: ", e);

Review Comment:
   With the current patch the exception happens even without running `ozone 
insight`.  (See my other comment for the reason.)



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to