Skip to content

Commit

Permalink
Refactored path normalisation filtering into shared
Browse files Browse the repository at this point in the history
  • Loading branch information
sophia-chen-ttd committed Jan 1, 2025
1 parent 3c5d621 commit bb9d8f5
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/main/java/com/uid2/admin/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");

Expand Down

0 comments on commit bb9d8f5

Please sign in to comment.