Matching logic is implemented here rather than in MetricsFilter because we would like
MetricsFilter to act as a "dumb" value-object, with the possibility of replacing it with a
Proto/JSON/etc. schema object.
filter - MetricsFilter with the matching information of an actual metric
public static boolean subPathMatches(java.lang.String haystack,
subPathMatches(haystack, needle) returns true if needle represents a path
within haystack. For example, "foo/bar" is in "a/foo/bar/b", but not "a/fool/bar/b" or
public static boolean matchesScope(java.lang.String actualScope,
matchesScope(actualScope, scopes) returns true if the scope of a metric is matched by
any of the filters in scopes. A metric scope is a path of type "A/B/D". A path is
matched by a filter if the filter is equal to the path (e.g. "A/B/D", or if it represents a
subpath within it (e.g. "A/B" or "B/D", but not "A/D").