diff --git a/CHANGELOG.md b/CHANGELOG.md index 108eb0004..4e1c9a39f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,9 @@ request adding CHANGELOG notes for breaking (!) changes and possibly other secti ### Upgrade notes +- The legacy management endpoints, `/metrics` and `/healthcheck`, were removed. Use the new endpoints instead: + `/q/metrics` and `/q/health`. + ### Breaking changes - Helm chart: the default value of the `authentication.tokenBroker.secret.symmetricKey.secretKey` property has changed diff --git a/runtime/service/src/main/java/org/apache/polaris/service/legacy/LegacyManagementEndpoints.java b/runtime/service/src/main/java/org/apache/polaris/service/legacy/LegacyManagementEndpoints.java deleted file mode 100644 index 284eb3df1..000000000 --- a/runtime/service/src/main/java/org/apache/polaris/service/legacy/LegacyManagementEndpoints.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.polaris.service.legacy; - -import io.quarkus.vertx.http.ManagementInterface; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.event.Observes; -import org.eclipse.microprofile.config.inject.ConfigProperty; - -@ApplicationScoped -public class LegacyManagementEndpoints { - - public void registerLegacyManagementRoutes( - @Observes ManagementInterface mi, - @ConfigProperty(name = "quarkus.management.root-path") String rootPath) { - mi.router().get("/metrics").handler(rc -> rc.reroute(rootPath + "/metrics")); - mi.router().get("/healthcheck").handler(rc -> rc.reroute(rootPath + "/health")); - } -} diff --git a/runtime/service/src/test/java/org/apache/polaris/service/metrics/MetricsTestBase.java b/runtime/service/src/test/java/org/apache/polaris/service/metrics/MetricsTestBase.java index 34722731e..5f3755834 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/metrics/MetricsTestBase.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/metrics/MetricsTestBase.java @@ -39,11 +39,10 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; @TestInstance(TestInstance.Lifecycle.PER_CLASS) @ExtendWith(TestEnvironmentExtension.class) @@ -72,26 +71,23 @@ public void clearMetrics() { registry.clear(); } - private Map fetchMetrics(String endpoint) { + private Map fetchMetrics() { AtomicReference> value = new AtomicReference<>(); Awaitility.await() .atMost(Duration.ofMinutes(2)) .untilAsserted( () -> { - value.set( - TestMetricsUtil.fetchMetrics( - fixture.client, testEnv.baseManagementUri(), endpoint)); + value.set(TestMetricsUtil.fetchMetrics(fixture.client, testEnv.baseManagementUri())); assertThat(value.get()).containsKey(API_METRIC_NAME); assertThat(value.get()).containsKey(HTTP_METRIC_NAME); }); return value.get(); } - @ParameterizedTest - @ValueSource(strings = {"%s/metrics", "%s/q/metrics"}) - public void testMetricsEmittedOnSuccessfulRequest(String endpoint) { + @Test + public void testMetricsEmittedOnSuccessfulRequest() { sendSuccessfulRequest(); - Map allMetrics = fetchMetrics(endpoint); + Map allMetrics = fetchMetrics(); assertThat(allMetrics).containsKey(API_METRIC_NAME); assertThat(allMetrics.get(API_METRIC_NAME).getMetrics()) .satisfiesOnlyOnce( @@ -138,11 +134,10 @@ public void testMetricsEmittedOnSuccessfulRequest(String endpoint) { }); } - @ParameterizedTest - @ValueSource(strings = {"%s/metrics", "%s/q/metrics"}) - public void testMetricsEmittedOnFailedRequest(String endpoint) { + @Test + public void testMetricsEmittedOnFailedRequest() { sendFailingRequest(); - Map allMetrics = fetchMetrics(endpoint); + Map allMetrics = fetchMetrics(); assertThat(allMetrics).containsKey(API_METRIC_NAME); assertThat(allMetrics.get(API_METRIC_NAME).getMetrics()) .satisfiesOnlyOnce( diff --git a/runtime/service/src/test/java/org/apache/polaris/service/ratelimiter/RateLimiterFilterTest.java b/runtime/service/src/test/java/org/apache/polaris/service/ratelimiter/RateLimiterFilterTest.java index ff66a4725..f3e2da7d4 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/ratelimiter/RateLimiterFilterTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/ratelimiter/RateLimiterFilterTest.java @@ -158,7 +158,7 @@ public void testMetricsAreEmittedWhenRateLimiting() { // polaris_principal_roles_listPrincipalRoles_seconds_count{application="Polaris",class="org.apache.polaris.service.admin.api.PolarisPrincipalRolesApi",environment="prod",exception="none",method="listPrincipalRoles"} 50.0 Map metrics = - TestMetricsUtil.fetchMetrics(fixture.client, testEnv.baseManagementUri(), "%s/q/metrics"); + TestMetricsUtil.fetchMetrics(fixture.client, testEnv.baseManagementUri()); assertThat(metrics) .isNotEmpty() diff --git a/runtime/service/src/test/java/org/apache/polaris/service/test/DefaultTestEnvironmentResolver.java b/runtime/service/src/test/java/org/apache/polaris/service/test/DefaultTestEnvironmentResolver.java index 6d40e2f22..50ddb250d 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/test/DefaultTestEnvironmentResolver.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/test/DefaultTestEnvironmentResolver.java @@ -29,7 +29,7 @@ public class DefaultTestEnvironmentResolver implements TestEnvironmentResolver { @Override public TestEnvironment resolveTestEnvironment(ExtensionContext extensionContext) { return new TestEnvironment( - String.format("http://localhost:%d", localPort), - String.format("http://localhost:%d", localManagementPort)); + String.format("http://localhost:%d/", localPort), + String.format("http://localhost:%d/", localManagementPort)); } } diff --git a/runtime/service/src/test/java/org/apache/polaris/service/test/TestMetricsUtil.java b/runtime/service/src/test/java/org/apache/polaris/service/test/TestMetricsUtil.java index eefca4534..7a74570bf 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/test/TestMetricsUtil.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/test/TestMetricsUtil.java @@ -36,10 +36,8 @@ /** Utils for working with metrics in tests */ public class TestMetricsUtil { - public static Map fetchMetrics( - Client client, URI baseManagementUri, String endpointPath) { - Response response = - client.target(String.format(endpointPath, baseManagementUri)).request().get(); + public static Map fetchMetrics(Client client, URI baseManagementUri) { + Response response = client.target(baseManagementUri.resolve("q/metrics")).request().get(); if (response.getStatus() == Status.MOVED_PERMANENTLY.getStatusCode()) { response = client.target(response.getLocation()).request().get(); }