Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sch-UID2-4073 high level tests for path normalisation in metrics #1235

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<enclave-aws.version>2.1.0</enclave-aws.version>
<enclave-azure.version>2.1.0</enclave-azure.version>
<enclave-gcp.version>2.1.0</enclave-gcp.version>
<uid2-shared.version>8.0.9</uid2-shared.version>
<uid2-shared.version>8.0.32</uid2-shared.version>
<image.version>${project.version}</image.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
Expand Down
11 changes: 3 additions & 8 deletions src/main/java/com/uid2/operator/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,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.CloudSyncVerticle;
import com.uid2.shared.vertx.ICloudSync;
import com.uid2.shared.vertx.RotatingStoreVerticle;
Expand Down Expand Up @@ -427,14 +428,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 {
String normalized = HttpUtils.normalizePath(actualPath).split("\\?")[0];
return Endpoints.pathSet().contains(normalized) ? normalized : "/unknown";
} catch (IllegalArgumentException e) {
return actualPath;
}
}))
.meterFilter(MeterFilter.replaceTagValues(Label.HTTP_PATH.toString(),
actualPath -> HTTPPathMetricFilter.filterPath(actualPath, Endpoints.pathSet())))
// Don't record metrics for 404s.
.meterFilter(MeterFilter.deny(id ->
id.getName().startsWith(MetricsDomain.HTTP_SERVER.getPrefix()) &&
Expand Down
Loading