public String getMetricsPrefix() {
    return Optional.ofNullable(getProperty(CommonConstants.Minion.CONFIG_OF_METRICS_PREFIX_KEY))
        .orElseGet(() -> getProperty(CommonConstants.Minion.DEPRECATED_CONFIG_OF_METRICS_PREFIX_KEY,
            CommonConstants.Minion.CONFIG_OF_METRICS_PREFIX));
  }
@Test
  public void testDeprecatedConfigs()
      throws ConfigurationException {
    // Check configs with old names that have no pinot.minion prefix.
    String[] cfgKeys = new String[]{
        CommonConstants.Minion.DEPRECATED_PREFIX_OF_CONFIG_OF_PINOT_FS_FACTORY,
        CommonConstants.Minion.DEPRECATED_PREFIX_OF_CONFIG_OF_SEGMENT_FETCHER_FACTORY,
        CommonConstants.Minion.DEPRECATED_PREFIX_OF_CONFIG_OF_SEGMENT_UPLOADER,
        CommonConstants.Minion.DEPRECATED_PREFIX_OF_CONFIG_OF_PINOT_CRYPTER
    };
    PropertiesConfiguration config = CommonsConfigurationUtils.fromPath(
        PropertiesConfiguration.class.getClassLoader().getResource("pinot-configuration-old-minion.properties")
        .getFile());
    PinotConfiguration rawCfg = new PinotConfiguration(config);
    final MinionConf oldConfig = new MinionConf(rawCfg.toMap());
    Assert.assertEquals(oldConfig.getMetricsPrefix(), "pinot.minion.old.custom.metrics.");
    for (String cfgKey : cfgKeys) {
      Assert.assertFalse(oldConfig.subset(cfgKey).isEmpty(), cfgKey);
      Assert.assertTrue(oldConfig.subset("pinot.minion." + cfgKey).isEmpty(), cfgKey);
    }

    // Check configs with new names that have the pinot.minion prefix.
    config = CommonsConfigurationUtils.fromPath(
        PropertiesConfiguration.class.getClassLoader().getResource("pinot-configuration-new-minion.properties")
            .getFile());
    rawCfg = new PinotConfiguration(config);
    final MinionConf newConfig = new MinionConf(rawCfg.toMap());
    for (String cfgKey : cfgKeys) {
      Assert.assertTrue(newConfig.subset(cfgKey).isEmpty(), cfgKey);
      Assert.assertFalse(newConfig.subset("pinot.minion." + cfgKey).isEmpty(), cfgKey);
    }
    // Check the config values.
    Assert.assertEquals(newConfig.getMetricsPrefix(), "pinot.minion.new.custom.metrics.");
    PinotConfiguration subcfg = newConfig.subset(CommonConstants.Minion.PREFIX_OF_CONFIG_OF_PINOT_FS_FACTORY);
    Assert.assertEquals(subcfg.subset("class").getProperty("s3"), "org.apache.pinot.plugin.filesystem.S3PinotFS");
    subcfg = newConfig.subset(CommonConstants.Minion.PREFIX_OF_CONFIG_OF_SEGMENT_FETCHER_FACTORY);
    Assert.assertEquals(subcfg.getProperty("protocols"), "file,http,s3");
    subcfg = newConfig.subset(CommonConstants.Minion.PREFIX_OF_CONFIG_OF_SEGMENT_UPLOADER);
    Assert.assertEquals(subcfg.subset("https").getProperty("enabled"), "true");
    subcfg = newConfig.subset(CommonConstants.Minion.PREFIX_OF_CONFIG_OF_PINOT_CRYPTER);
    Assert.assertEquals(subcfg.subset("class").getProperty("nooppinotcrypter"),
        "org.apache.pinot.core.crypt.NoOpPinotCrypter");
  }