accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From milleruntime <...@git.apache.org>
Subject [GitHub] accumulo pull request #225: ACCUMULO-4593 Move metrics config to templates d...
Date Thu, 02 Mar 2017 12:38:04 GMT
Github user milleruntime commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/225#discussion_r103914280
  
    --- Diff: server/base/src/main/java/org/apache/accumulo/server/metrics/MetricsConfiguration.java
---
    @@ -148,46 +148,35 @@ public Configuration getMetricsConfiguration() {
       }
     
       private void loadConfiguration() {
    -    String accumuloConfDir = getEnvironmentConfiguration().getString("ACCUMULO_CONF_DIR");
    -    if (null != accumuloConfDir) {
    -      // Try to load the metrics properties file
    -      File mFile = new File(accumuloConfDir, metricsFileName);
    -      if (mFile.exists()) {
    -        if (log.isDebugEnabled())
    -          log.debug("Loading config file: " + mFile.getAbsolutePath());
    -        try {
    -          xConfig = new XMLConfiguration(mFile);
    -          xConfig.append(getEnvironmentConfiguration());
    -          xConfig.addConfigurationListener(new MetricsConfigListener());
    -          xConfig.setReloadingStrategy(new FileChangedReloadingStrategy());
    -
    -          // Start a background Thread that checks a property from the XMLConfiguration
    -          // every so often to force the FileChangedReloadingStrategy to fire.
    -          if (null == watcher || !watcher.isAlive()) {
    -            watcher = new MetricsConfigWatcher();
    -            watcher.start();
    -          }
    -          notFound = false;
    -          alreadyWarned = false;
    -        } catch (ConfigurationException ce) {
    -          log.error("Error reading accumulo-metrics.xml file.");
    -          notFound = true;
    -          return;
    -        }
    -      } else {
    -        if (!alreadyWarned)
    -          log.warn("Unable to find metrics file: " + mFile.getAbsolutePath());
    -        alreadyWarned = true;
    -        notFound = true;
    -        return;
    -      }
    -    } else {
    +    URL metricsUrl = MetricsConfiguration.class.getClassLoader().getResource("accumulo-metrics.xml");
    +    if (metricsUrl == null) {
           if (!alreadyWarned)
    -        log.warn("ACCUMULO_CONF_DIR variable not found in environment. Metrics collection
will be disabled.");
    +        log.warn("accumulo-metrics.xml was not found on classpath. Metrics collection
will be disabled.");
           alreadyWarned = true;
    --- End diff --
    
    With the above simplification, looks like you don't need the `alreadyWarned` boolean anymore.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message