Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-2737

Insight point should provide service type to get correct config

    XMLWordPrintableJSON

Details

    Description

      Currently, ozone insight cmd can help us get config that being used in ozone service. However, sometimes it maybe not redirect the request for the right service.

      For example, we want to query the om insight point, om.key-manager, but ConfigurationSubCommand hard coded use SCM type to get service conf. The method getHost will return the address of SCM service but actually we need to get the OM service which is the right service we want to query from.

       

        private void showConfig(Class clazz) {
          OzoneConfiguration conf = new OzoneConfiguration();
          conf.addResource(getHost(conf, new Component(Type.SCM)) + "/conf");
          ConfigGroup configGroup =
              (ConfigGroup) clazz.getAnnotation(ConfigGroup.class);
          if (configGroup == null) {
            return;
          }
      
          String prefix = configGroup.prefix();
      
          for (Method method : clazz.getMethods()) {
            if (method.isAnnotationPresent(Config.class)) {
              Config config = method.getAnnotation(Config.class);
              String key = prefix + "." + config.key();
              System.out.println(">>> " + key);
              System.out.println("       default: " + config.defaultValue());
              System.out.println("       current: " + conf.get(key));
              System.out.println();
              System.out.println(config.description());
              System.out.println();
              System.out.println();
      
            }
          }
      
        }
      

       

      Attachments

        Issue Links

          Activity

            People

              cxorm Yi-Sheng Lien
              linyiqun Yiqun Lin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m