Skip to content

Commit e0fc7cd

Browse files
Merge pull request #1235 from IABTechLab/sch-UID2-4073-high-level-tests-path-normalisation-metrics
sch-UID2-4073 high level tests for path normalisation in metrics
2 parents c3b2f03 + a65ac59 commit e0fc7cd

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
@@ -22,7 +22,7 @@
2222
<enclave-aws.version>2.1.0</enclave-aws.version>
2323
<enclave-azure.version>2.1.0</enclave-azure.version>
2424
<enclave-gcp.version>2.1.0</enclave-gcp.version>
25-
<uid2-shared.version>8.0.9</uid2-shared.version>
25+
<uid2-shared.version>8.0.32</uid2-shared.version>
2626
<image.version>${project.version}</image.version>
2727
<maven.compiler.source>21</maven.compiler.source>
2828
<maven.compiler.target>21</maven.compiler.target>

src/main/java/com/uid2/operator/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.store.RotatingSaltProvider;
2626
import com.uid2.shared.store.reader.*;
2727
import com.uid2.shared.store.scope.GlobalScope;
28+
import com.uid2.shared.util.HTTPPathMetricFilter;
2829
import com.uid2.shared.vertx.CloudSyncVerticle;
2930
import com.uid2.shared.vertx.ICloudSync;
3031
import com.uid2.shared.vertx.RotatingStoreVerticle;
@@ -427,14 +428,8 @@ private static void setupMetrics(MicrometerMetricsOptions metricOptions) {
427428
prometheusRegistry.config()
428429
// providing common renaming for prometheus metric, e.g. "hello.world" to "hello_world"
429430
.meterFilter(new PrometheusRenameFilter())
430-
.meterFilter(MeterFilter.replaceTagValues(Label.HTTP_PATH.toString(), actualPath -> {
431-
try {
432-
String normalized = HttpUtils.normalizePath(actualPath).split("\\?")[0];
433-
return Endpoints.pathSet().contains(normalized) ? normalized : "/unknown";
434-
} catch (IllegalArgumentException e) {
435-
return actualPath;
436-
}
437-
}))
431+
.meterFilter(MeterFilter.replaceTagValues(Label.HTTP_PATH.toString(),
432+
actualPath -> HTTPPathMetricFilter.filterPath(actualPath, Endpoints.pathSet())))
438433
// Don't record metrics for 404s.
439434
.meterFilter(MeterFilter.deny(id ->
440435
id.getName().startsWith(MetricsDomain.HTTP_SERVER.getPrefix()) &&

0 commit comments

Comments
 (0)