You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "ptlrs (via GitHub)" <gi...@apache.org> on 2025/10/14 08:40:41 UTC

[PR] HDDS-499. Display descriptions for properties on the configuration page [ozone]

ptlrs opened a new pull request, #9152:
URL: https://github.com/apache/ozone/pull/9152

   ## What changes were proposed in this pull request?
   
   When the properties are read by the internal hadoop libraries from the config files, they return a simple hashmap of keys and values. It maybe more complex to update that code to also return descriptions. As a workaround, we reads the config files and extract the configuration descriptions separately. 
   
   This PR:
   1. Reads config files and extracts the configuration descriptions
   2. Returns a JSON with the descriptions
   3. Updates the javascript template to set the description field
   4. Adds monospace font for keys and values to improve readability
   
   Note: You may need to disable the cache from developer tools to see the effect of these changes locally. 
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-499
   
   ## How was this patch tested?
   
   CI: https://github.com/ptlrs/ozone/actions/runs/18490389759
   
   <img width="1727" height="489" alt="Screenshot 2025-10-14 at 1 37 13 AM" src="https://github.com/user-attachments/assets/d93c1255-9a68-4531-b714-bc91d0fef4a2" />
   
   <img width="1728" height="573" alt="Screenshot 2025-10-14 at 1 37 37 AM" src="https://github.com/user-attachments/assets/e7a9110d-0b5b-4262-afe7-c8c66224616e" />
   


-- 
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: issues-unsubscribe@ozone.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-499. Display descriptions for properties on the configuration page [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai merged PR #9152:
URL: https://github.com/apache/ozone/pull/9152


-- 
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: issues-unsubscribe@ozone.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-499. Display descriptions for properties on the configuration page [ozone]

Posted by "ptlrs (via GitHub)" <gi...@apache.org>.
ptlrs commented on PR #9152:
URL: https://github.com/apache/ozone/pull/9152#issuecomment-3454755787

   Hi @devabhishekpal, can you please review this PR?


-- 
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: issues-unsubscribe@ozone.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-499. Display descriptions for properties on the configuration page [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #9152:
URL: https://github.com/apache/ozone/pull/9152#discussion_r2503996287


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/conf/HddsConfServlet.java:
##########
@@ -41,13 +53,53 @@
 public class HddsConfServlet extends HttpServlet {
 
   private static final long serialVersionUID = 1L;
+  private static final Logger LOG = LoggerFactory.getLogger(HddsConfServlet.class);
 
   protected static final String FORMAT_JSON = "json";
   protected static final String FORMAT_XML = "xml";
   private static final String COMMAND = "cmd";
   private static final OzoneConfiguration OZONE_CONFIG =
       new OzoneConfiguration();
 
+  /**
+   * Represents metadata for a configuration property, including its name, value and description.
+   */
+  public static class PropertyMetadata {

Review Comment:
   Can we reuse `OzoneConfiguration.Property` instead of adding a new class?
   
   https://github.com/apache/ozone/blob/3f54b1452c5b725431c69ca25e0bb2a3d400894e/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/conf/OzoneConfiguration.java#L148



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/conf/HddsConfServlet.java:
##########
@@ -165,6 +226,92 @@ private void processConfigTagRequest(HttpServletRequest request, String cmd,
 
   }
 
+  /**
+   * Build a map of property names to descriptions by reading from configuration resources.
+   * @param config the OzoneConfiguration to extract descriptions from
+   * @return map of property name to description
+   */
+  private Map<String, String> buildDescriptionMap(OzoneConfiguration config) {
+    Map<String, String> descriptionMap = new HashMap<>();
+    
+    // List of configuration resource names to check
+    String[] configResources = new String[] {
+        "core-default.xml",
+        "core-site.xml",
+        "hdfs-default.xml",
+        "hdfs-site.xml",
+        "hdds-common-default.xml",
+        "hdds-client-default.xml",
+        "hdds-container-service-default.xml",
+        "hdds-server-framework-default.xml",
+        "hdds-server-scm-default.xml",
+        "ozone-common-default.xml",
+        "ozone-csi-default.xml",
+        "ozone-manager-default.xml",
+        "ozone-recon-default.xml",
+        "ozone-default.xml",
+        "ozone-site.xml"
+    };

Review Comment:
   Please define the list of resources in `OzoneConfiguration` and use it in both places, here and in:
   
   https://github.com/apache/ozone/blob/3f54b1452c5b725431c69ca25e0bb2a3d400894e/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/conf/OzoneConfiguration.java#L213



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/conf/HddsConfServlet.java:
##########
@@ -165,6 +226,92 @@ private void processConfigTagRequest(HttpServletRequest request, String cmd,
 
   }
 
+  /**
+   * Build a map of property names to descriptions by reading from configuration resources.
+   * @param config the OzoneConfiguration to extract descriptions from
+   * @return map of property name to description
+   */
+  private Map<String, String> buildDescriptionMap(OzoneConfiguration config) {
+    Map<String, String> descriptionMap = new HashMap<>();
+    
+    // List of configuration resource names to check
+    String[] configResources = new String[] {
+        "core-default.xml",
+        "core-site.xml",
+        "hdfs-default.xml",
+        "hdfs-site.xml",
+        "hdds-common-default.xml",
+        "hdds-client-default.xml",
+        "hdds-container-service-default.xml",
+        "hdds-server-framework-default.xml",
+        "hdds-server-scm-default.xml",
+        "ozone-common-default.xml",
+        "ozone-csi-default.xml",
+        "ozone-manager-default.xml",
+        "ozone-recon-default.xml",
+        "ozone-default.xml",
+        "ozone-site.xml"
+    };
+    
+    for (String resourceName : configResources) {
+      try {
+        URL resourceUrl = config.getResource(resourceName);
+        if (resourceUrl != null) {
+          parseXmlDescriptions(resourceUrl, descriptionMap);
+        }
+      } catch (Exception e) {
+        LOG.error("Could not read descriptions from resource: {}", resourceName, e);
+      }
+    }
+
+    return descriptionMap;
+  }
+
+  /**
+   * Parse XML configuration file and extract property descriptions using DOM parser.
+   * @param resourceUrl URL of the XML resource to parse
+   * @param descriptionMap map to populate with property name -> description mappings
+   */
+  private void parseXmlDescriptions(URL resourceUrl, Map<String, String> descriptionMap) {
+    try (InputStream inputStream = resourceUrl.openStream()) {
+      DocumentBuilderFactory factory = XMLUtils.newSecureDocumentBuilderFactory();
+      DocumentBuilder builder = factory.newDocumentBuilder();

Review Comment:
   Please reuse the factory and builder in `buildDescriptionMap` for parsing all files.



-- 
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: issues-unsubscribe@ozone.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-499. Display descriptions for properties on the configuration page [ozone]

Posted by "ptlrs (via GitHub)" <gi...@apache.org>.
ptlrs commented on PR #9152:
URL: https://github.com/apache/ozone/pull/9152#issuecomment-3506798909

   Thanks for the review @adoroszlai. I have updated the code with the changes. 


-- 
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: issues-unsubscribe@ozone.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-499. Display descriptions for properties on the configuration page [ozone]

Posted by "ptlrs (via GitHub)" <gi...@apache.org>.
ptlrs commented on PR #9152:
URL: https://github.com/apache/ozone/pull/9152#issuecomment-3499406563

   Thanks for the review @devabhishekpal.
   
   @errose28 @adoroszlai can you please take a look and help to merge 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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-499. Display descriptions for properties on the configuration page [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #9152:
URL: https://github.com/apache/ozone/pull/9152#issuecomment-3552803572

   thanks @ptlrs for the patch, @devabhishekpal for the review.


-- 
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: issues-unsubscribe@ozone.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org