Skip to content

Commit 7cfdcb0

Browse files
committed
Fix matching regex in Play plugin.
The regex `<.*>` has eager/greedy matching - it will match as many characters as possible. This means that if there are multiple bound variables in a path, this will match all the characters between them, removing it from the resulting path label. This commit changes the regex to use a "reluctant" quantifier.
1 parent a1acc66 commit 7cfdcb0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

yax/play/src/main/scala/org/lyranthe/prometheus/client/integration/play/filters/PrometheusFilter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class PrometheusFilter @Inject()(implicit
6666
for {
6767
method <- requestHeader.tags.get("ROUTE_VERB")
6868
routePattern <- requestHeader.tags.get("ROUTE_PATTERN")
69-
route = routePattern.replaceAll("<.*>", "").replaceAll("\\$", ":")
69+
route = routePattern.replaceAll("<.*?>", "").replaceAll("\\$", ":")
7070
} yield RouteDetails(method, route)
7171
}
7272

0 commit comments

Comments
 (0)