From bb9d8f520fcfcf776f3dc0ca608cec22570cd9fd Mon Sep 17 00:00:00 2001 From: sophia chen Date: Thu, 2 Jan 2025 09:18:34 +1100 Subject: [PATCH] Refactored path normalisation filtering into shared --- src/main/java/com/uid2/admin/Main.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/uid2/admin/Main.java b/src/main/java/com/uid2/admin/Main.java index ed05b34d..afa7f34c 100644 --- a/src/main/java/com/uid2/admin/Main.java +++ b/src/main/java/com/uid2/admin/Main.java @@ -42,6 +42,7 @@ import com.uid2.shared.store.RotatingSaltProvider; import com.uid2.shared.store.reader.*; import com.uid2.shared.store.scope.GlobalScope; +import com.uid2.shared.util.HTTPPathMetricFilter; import com.uid2.shared.vertx.VertxUtils; import io.micrometer.core.instrument.Gauge; import io.micrometer.core.instrument.MeterRegistry; @@ -422,13 +423,8 @@ private static void setupMetrics(MicrometerMetricsOptions metricOptions) { prometheusRegistry.config() // providing common renaming for prometheus metric, e.g. "hello.world" to "hello_world" .meterFilter(new PrometheusRenameFilter()) - .meterFilter(MeterFilter.replaceTagValues(Label.HTTP_PATH.toString(), actualPath -> { - try { - return HttpUtils.normalizePath(actualPath).split("\\?")[0]; - } catch (IllegalArgumentException e) { - return actualPath; - } - })) + .meterFilter(MeterFilter.replaceTagValues(Label.HTTP_PATH.toString(), + actualPath -> HTTPPathMetricFilter.filterPath(actualPath, Set.of()))) // adding common labels .commonTags("application", "uid2-admin");