public boolean acceptMetric(String metricName) {

    boolean accept = false;

    /*
      Include entities to be tracked.
      source.database.monitor.entities=Cluster(.*)Entity,Host(.*)Entity,ExecutionCommandEntity
     */
    if (acceptedEntities.contains(metricName)) {
      accept = true;
    } else {
      for (Pattern p : acceptedEntityPatterns) {
        Matcher m = p.matcher(metricName);
        if (m.find()) {
          accept = true;
        }
      }
    }

    /*
    Include some metrics which have the keyword even if they are not part of requested Entities.
    source.database.monitor.query.keywords.include=CacheMisses
     */

    for (String keyword : includedMetricKeywords) {
      if (metricName.contains(keyword)) {
        accept = true;
      }
    }

    String[] splits = metricName.split("\\.");
    if (splits.length <= 2) {
      accept = true; //Aggregate Counter metrics are always ok. They are not Entity specific
    }

    if (accept) {
      acceptedEntities.add(metricName);
      return true;
    }

    return false;
  }
Accept a metric to be passed to Sink or not.
@param metricName
@return true/false
ambari-server/src/main/java/org/apache/ambari/server/metrics/system/impl/DatabaseMetricsSource.java