Each metric must have its own filters copy to modify it freely
172875
def __get_metrics(self):
        
        esfilters_merge = None
        esfilters_abandon = None
        esfilters_submit = None
        if self.esfilters:
            esfilters_merge = self.esfilters.copy()
            esfilters_abandon = self.esfilters.copy()
            esfilters_submit = self.esfilters.copy()

        merged = Merged(self.es_url, self.es_index,
                        start=self.start, end=self.end,
                        esfilters=esfilters_merge, interval=self.interval)
        # For BMI we need when the ticket was closed
        merged.FIELD_DATE = 'closed'

        abandoned = Abandoned(self.es_url, self.es_index,
                              start=self.start, end=self.end,
                              esfilters=esfilters_abandon, interval=self.interval)
        # For BMI we need when the ticket was closed
        abandoned.FIELD_DATE = 'closed'

        submitted = Submitted(self.es_url, self.es_index,
                              start=self.start, end=self.end,
                              esfilters=esfilters_submit,
                              interval=self.interval)

        return (merged, abandoned, submitted)
55818
private Map<String, String> getMetricFilterParameters( MetricFilterOptions options ) {
        if( options == null ) {
            return null;
        }

        Map<String, String> parameters = new HashMap<String, String>();

        AWSCloud.addValueIfNotNull(parameters, "MetricName", options.getMetricName());
        AWSCloud.addValueIfNotNull(parameters, "Namespace", options.getMetricNamespace());
        AWSCloud.addIndexedParameters(parameters, "Dimensions.member.", options.getMetricMetadata());

        if( parameters.size() == 0 ) {
            return null;
        }

        return parameters;
    }
662181
@Override
  public SortedMap<String, Histogram> getHistograms(MetricFilter filter) {
    return this.innerMetricContext.getHistograms(filter);
  }
361325
protected List<Metric> filter(List<Metric> metrics) {
    final List<Metric> filtered = metrics.stream().filter(this::shouldIncludeMetric)
        .collect(Collectors.toList());
    LOGGER.debug("Filter: input {} metrics, output {} metrics",
        metrics.size(), filtered.size());
    return filtered;
  }
1249451
@Nonnull
	static Collection<MetricLocation> prepareGetMetricUrls(List<String> metricMasks, String tableFilter, boolean underscoreAsLiteral) {
		if (WildcardsUtil.isRetrieveAllPattern(tableFilter) || tableFilter.isEmpty()) {
			if (metricMasks.isEmpty()) {
				return Collections.emptyList();
			} else {
				return buildPatternDisjunction(metricMasks, underscoreAsLiteral);
			}
		} else  {
			return Collections.singletonList(buildAtsdPatternUrl(tableFilter, underscoreAsLiteral));
		}
	}
1125722
def delete_metric(self, slug):
        """"""

        # To remove all keys for a slug, I need to retrieve them all from
        # the set of metric keys, This uses the redis "keys" command, which is
        # inefficient, but this shouldn't be used all that often.
        prefix = "m:{0}:*".format(slug)
        keys = self.r.keys(prefix)
        self.r.delete(*keys)  # Remove the metric data

        # Finally, remove the slug from the set
        self.r.srem(self._metric_slugs_key, slug)
925444
function copy(obj) {
  var filters = copy.filterFactory(obj.filter);
  var source = copy.sourceFactory(obj.source, filters);
  var dest = copy.destFactory(obj.dest, filters);
  dest.processSource(source);
}
1344111
public MetricFilter metricsFilter() {
        if (id() == null) {
            return (name, metric) -> false;
        }
        return (name, metric) -> metricNames.contains(name);

    }
1283012
public MetricFilter metricsFilter() {
        if (meterName == null) {
            return (name, metric) -> false;
        }
        return new MetricUtils.SingleMetricFilter(meterName);

    }
865261
def apply_filters(self, filters):
        
        _configs = self.configs
        _stats = self.stats
        self.configs = {}
        self.stats = {}
        for f in filters:
            if f in _configs:
                self.configs[f] = _configs[f]
            elif f in _stats:
                self.stats[f] = _stats[f]
            else:
                raise NoSuchControlFileError("%s for %s" % (f, self.subsystem.name))
628895
def filter(self, *args, **kwargs):
        
        clone = self._clone()
        for f in args:
            clone.filter_obj.add_filter(f)
        for key, value in kwargs.items():
            clone.filter_obj.add_filter_param(key, value)
        return clone
912956
@SuppressWarnings("unchecked")
	private <T extends Number> List<Metric<T>> filterCounters(Iterable<Metric<?>> input) {
		List<Metric<T>> result = new ArrayList<>();
		for (Metric<?> metric : input) {
			if (metric.getName().startsWith(COUNTER_PREFIX)) {
				result.add((Metric<T>) metric);
			}
		}
		return result;
	}
143686
def __get_metrics(self):
        
        esfilters_merge = None
        esfilters_abandon = None
        if self.esfilters:
            esfilters_merge = self.esfilters.copy()
            esfilters_abandon = self.esfilters.copy()

        merged = Merged(self.es_url, self.es_index,
                        start=self.start, end=self.end,
                        esfilters=esfilters_merge, interval=self.interval)

        abandoned = Abandoned(self.es_url, self.es_index,
                              start=self.start, end=self.end,
                              esfilters=esfilters_abandon, interval=self.interval)
        return (merged, abandoned)
1031419
function Perf (stats, name, filter, rename) {
  this.stats = stats
  this.name = name
  this.filter = filter || function () { return true }
  this.rename = rename || function (name) { return name }
}
1309326
def _create_extractors(cls, metrics):
        
        metrics_dict = {}
        # group entries by `category` attribute (default is "standard")
        for metric, config in six.iteritems(metrics):
            category = config.get('category', StdBenchmark.DEFAULT_CATEGORY)
            metrics_dict.setdefault(category, {})[metric] = config
        # create one StdExtractor instance per category,
        # passing associated metrics
        return dict(
            (category, StdExtractor(metrics))
            for category, metrics in six.iteritems(metrics_dict)
        )
852550
function filter(mMap, fnFilter) {
			return Object.keys(mMap).filter(fnFilter).reduce(copyTo.bind(mMap), {});
		}
338967
function (filters, tpl) {
      for (var i = 0; i < filters.length; ++i) {
        tpl = filters[i](tpl)
      }
      return tpl
    }