Skip to content

Commit a0b566b

Browse files
authored
Merge pull request #18 from fiadliel/PlayRouteParsingIssue
Removed broken regex and replaced with a replace all
2 parents 26c30e7 + d5938fb commit a0b566b

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ class PrometheusFilter @Inject()(implicit
2222
) extends Filter {
2323
private final val ServerErrorClass = "5xx"
2424

25-
private final val RouteRegex = "^/[^<]*".r
26-
2725
private val httpHistogramBuckets = {
2826
val buckets = for (p <- Vector[Double](0.0001, 0.001, 0.01, 0.1, 1, 10);
2927
s <- Vector(1, 2, 5)) yield (p * s)
@@ -68,8 +66,7 @@ class PrometheusFilter @Inject()(implicit
6866
for {
6967
method <- requestHeader.tags.get("ROUTE_VERB")
7068
routePattern <- requestHeader.tags.get("ROUTE_PATTERN")
71-
routeTemplate <- RouteRegex findFirstIn routePattern
72-
route = routeTemplate.replaceAll("\\$", ":")
69+
route = routePattern.replaceAll("<.*>", "").replaceAll("\\$", ":")
7370
} yield RouteDetails(method, route)
7471
}
7572

0 commit comments

Comments
 (0)