Skip to content

Commit 9f346b2

Browse files
Merge pull request #198 from IABTechLab/sch-UID2-4073-high-level-tests-path-normalisation-metrics
sch-UID2-4073 high level tests for path normalisation in metrics
2 parents 93278cd + 400b47d commit 9f346b2

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<vertx.verticle>com.uid2.core.vertx.CoreVerticle</vertx.verticle>
2525
<launcher.class>io.vertx.core.Launcher</launcher.class>
2626

27-
<uid2-shared.version>8.0.25</uid2-shared.version>
27+
<uid2-shared.version>8.0.32</uid2-shared.version>
2828
<image.version>${project.version}</image.version>
2929
</properties>
3030

src/main/java/com/uid2/core/Main.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.uid2.shared.secure.nitro.InMemoryAWSCertificateStore;
2626
import com.uid2.shared.store.CloudPath;
2727
import com.uid2.shared.store.scope.GlobalScope;
28+
import com.uid2.shared.util.HTTPPathMetricFilter;
2829
import com.uid2.shared.vertx.RotatingStoreVerticle;
2930
import com.uid2.shared.vertx.VertxUtils;
3031
import io.micrometer.core.instrument.Gauge;
@@ -187,14 +188,8 @@ private static void setupMetrics(MicrometerMetricsOptions metricOptions) {
187188
prometheusRegistry.config()
188189
// providing common renaming for prometheus metric, e.g. "hello.world" to "hello_world"
189190
.meterFilter(new PrometheusRenameFilter())
190-
.meterFilter(MeterFilter.replaceTagValues(Label.HTTP_PATH.toString(), actualPath -> {
191-
try {
192-
String normalized = HttpUtils.normalizePath(actualPath).split("\\?")[0];
193-
return Endpoints.pathSet().contains(normalized) ? normalized : "/unknown";
194-
} catch (IllegalArgumentException e) {
195-
return actualPath;
196-
}
197-
}))
191+
.meterFilter(MeterFilter.replaceTagValues(Label.HTTP_PATH.toString(),
192+
actualPath -> HTTPPathMetricFilter.filterPath(actualPath, Endpoints.pathSet())))
198193
// Don't record metrics for 404s.
199194
.meterFilter(MeterFilter.deny(id ->
200195
id.getName().startsWith(MetricsDomain.HTTP_SERVER.getPrefix()) &&

0 commit comments

Comments
 (0)