@Test public void testParsePathIgnoreNoLeadingSlash() { RequestMetric requestMetric = new RequestMetric(); VertxMetricsTags.parseUriPath(requestMetric, NO_MATCH_PATTERNS, ignorePatterns, "ignore/me/with/no/leading/slash"); Assertions.assertEquals("/ignore/me/with/no/leading/slash", requestMetric.path); Assertions.assertFalse(requestMetric.measure); Assertions.assertFalse(requestMetric.pathMatched); }
static void parseUriPath(RequestMetric requestMetric, Map<Pattern, String> matchPattern, List<Pattern> ignorePatterns, String uri) { if (uri == null) { return; } String path = "/" + extractPath(uri); path = MULTIPLE_SLASH_PATTERN.matcher(path).replaceAll("/"); path = TRAILING_SLASH_PATTERN.matcher(path).replaceAll(""); if (path.isEmpty()) { path = "/"; } requestMetric.path = path; for (Map.Entry<Pattern, String> mp : matchPattern.entrySet()) { requestMetric.path = mp.getKey().matcher(requestMetric.path).replaceAll(mp.getValue()); } requestMetric.pathMatched = !path.equals(requestMetric.path); for (Pattern p : ignorePatterns) { if (p.matcher(path).matches()) { log.debugf("Path %s ignored; matches pattern %s", uri, p.pattern()); return; } } requestMetric.measure = true; }
VertxMetricsTags { static void parseUriPath(RequestMetric requestMetric, Map<Pattern, String> matchPattern, List<Pattern> ignorePatterns, String uri) { if (uri == null) { return; } String path = "/" + extractPath(uri); path = MULTIPLE_SLASH_PATTERN.matcher(path).replaceAll("/"); path = TRAILING_SLASH_PATTERN.matcher(path).replaceAll(""); if (path.isEmpty()) { path = "/"; } requestMetric.path = path; for (Map.Entry<Pattern, String> mp : matchPattern.entrySet()) { requestMetric.path = mp.getKey().matcher(requestMetric.path).replaceAll(mp.getValue()); } requestMetric.pathMatched = !path.equals(requestMetric.path); for (Pattern p : ignorePatterns) { if (p.matcher(path).matches()) { log.debugf("Path %s ignored; matches pattern %s", uri, p.pattern()); return; } } requestMetric.measure = true; } }
VertxMetricsTags { static void parseUriPath(RequestMetric requestMetric, Map<Pattern, String> matchPattern, List<Pattern> ignorePatterns, String uri) { if (uri == null) { return; } String path = "/" + extractPath(uri); path = MULTIPLE_SLASH_PATTERN.matcher(path).replaceAll("/"); path = TRAILING_SLASH_PATTERN.matcher(path).replaceAll(""); if (path.isEmpty()) { path = "/"; } requestMetric.path = path; for (Map.Entry<Pattern, String> mp : matchPattern.entrySet()) { requestMetric.path = mp.getKey().matcher(requestMetric.path).replaceAll(mp.getValue()); } requestMetric.pathMatched = !path.equals(requestMetric.path); for (Pattern p : ignorePatterns) { if (p.matcher(path).matches()) { log.debugf("Path %s ignored; matches pattern %s", uri, p.pattern()); return; } } requestMetric.measure = true; }  }
VertxMetricsTags { static void parseUriPath(RequestMetric requestMetric, Map<Pattern, String> matchPattern, List<Pattern> ignorePatterns, String uri) { if (uri == null) { return; } String path = "/" + extractPath(uri); path = MULTIPLE_SLASH_PATTERN.matcher(path).replaceAll("/"); path = TRAILING_SLASH_PATTERN.matcher(path).replaceAll(""); if (path.isEmpty()) { path = "/"; } requestMetric.path = path; for (Map.Entry<Pattern, String> mp : matchPattern.entrySet()) { requestMetric.path = mp.getKey().matcher(requestMetric.path).replaceAll(mp.getValue()); } requestMetric.pathMatched = !path.equals(requestMetric.path); for (Pattern p : ignorePatterns) { if (p.matcher(path).matches()) { log.debugf("Path %s ignored; matches pattern %s", uri, p.pattern()); return; } } requestMetric.measure = true; }  static Tag method(HttpMethod method); static Tag status(int statusCode); static Tag outcome(HttpServerResponse response); static Tag outcome(HttpClientResponse response); static Tag uri(String pathInfo, int code); }
VertxMetricsTags { static void parseUriPath(RequestMetric requestMetric, Map<Pattern, String> matchPattern, List<Pattern> ignorePatterns, String uri) { if (uri == null) { return; } String path = "/" + extractPath(uri); path = MULTIPLE_SLASH_PATTERN.matcher(path).replaceAll("/"); path = TRAILING_SLASH_PATTERN.matcher(path).replaceAll(""); if (path.isEmpty()) { path = "/"; } requestMetric.path = path; for (Map.Entry<Pattern, String> mp : matchPattern.entrySet()) { requestMetric.path = mp.getKey().matcher(requestMetric.path).replaceAll(mp.getValue()); } requestMetric.pathMatched = !path.equals(requestMetric.path); for (Pattern p : ignorePatterns) { if (p.matcher(path).matches()) { log.debugf("Path %s ignored; matches pattern %s", uri, p.pattern()); return; } } requestMetric.measure = true; }  static Tag method(HttpMethod method); static Tag status(int statusCode); static Tag outcome(HttpServerResponse response); static Tag outcome(HttpClientResponse response); static Tag uri(String pathInfo, int code);  }