aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2023-03-20 11:24:17 +0100
committerHarald Musum <musum@yahooinc.com>2023-03-20 11:24:17 +0100
commitbc3b2d145dce727ed1defa5ac5f10dd7bc7c72ba (patch)
tree34672b4921500629f0c562c88abc07f935ac14df /controller-server
parenta01b0d47680947b0b253fdfc484faf543a000cf6 (diff)
proton metrics -> searchnode metrics
Use name of service and add API that does not use the generic /metrics path for searchnode metrics
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java16
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java15
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java30
3 files changed, 30 insertions, 31 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
index b1df25c933b..6c614738ddf 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
@@ -57,7 +57,7 @@ import com.yahoo.vespa.hosted.controller.Instance;
import com.yahoo.vespa.hosted.controller.LockedTenant;
import com.yahoo.vespa.hosted.controller.NotExistsException;
import com.yahoo.vespa.hosted.controller.api.application.v4.EnvironmentResource;
-import com.yahoo.vespa.hosted.controller.api.application.v4.model.ProtonMetrics;
+import com.yahoo.vespa.hosted.controller.api.application.v4.model.SearchNodeMetrics;
import com.yahoo.vespa.hosted.controller.api.identifiers.ClusterId;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.identifiers.TenantId;
@@ -286,7 +286,9 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler {
if (path.matches("/application/v4/tenant/{tenant}/application/{application}/instance/{instance}/environment/{environment}/region/{region}/access/support")) return supportAccess(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region"), request.propertyMap());
if (path.matches("/application/v4/tenant/{tenant}/application/{application}/instance/{instance}/environment/{environment}/region/{region}/node/{node}/service-dump")) return getServiceDump(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region"), path.get("node"), request);
if (path.matches("/application/v4/tenant/{tenant}/application/{application}/instance/{instance}/environment/{environment}/region/{region}/scaling")) return scaling(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region"), request);
- if (path.matches("/application/v4/tenant/{tenant}/application/{application}/environment/{environment}/region/{region}/instance/{instance}/metrics")) return metrics(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region"));
+ // TODO: Remove when not used anymore (migrated to ../metrics/searchnode)
+ if (path.matches("/application/v4/tenant/{tenant}/application/{application}/environment/{environment}/region/{region}/instance/{instance}/metrics")) return searchNodeMetrics(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region"));
+ if (path.matches("/application/v4/tenant/{tenant}/application/{application}/environment/{environment}/region/{region}/instance/{instance}/metrics/searchnode")) return searchNodeMetrics(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region"));
if (path.matches("/application/v4/tenant/{tenant}/application/{application}/instance/{instance}/environment/{environment}/region/{region}/global-rotation")) return rotationStatus(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region"), Optional.ofNullable(request.getProperty("endpointId")));
if (path.matches("/application/v4/tenant/{tenant}/application/{application}/instance/{instance}/environment/{environment}/region/{region}/global-rotation/override")) return getGlobalRotationOverride(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region"));
if (path.matches("/application/v4/tenant/{tenant}/application/{application}/environment/{environment}/region/{region}/instance/{instance}")) return deployment(path.get("tenant"), path.get("application"), path.get("instance"), path.get("environment"), path.get("region"), request);
@@ -1461,12 +1463,12 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler {
return new SlimeJsonResponse(SupportAccessSerializer.serializeCurrentState(disallowed, controller.clock().instant()));
}
- private HttpResponse metrics(String tenantName, String applicationName, String instanceName, String environment, String region) {
+ private HttpResponse searchNodeMetrics(String tenantName, String applicationName, String instanceName, String environment, String region) {
ApplicationId application = ApplicationId.from(tenantName, applicationName, instanceName);
ZoneId zone = requireZone(environment, region);
DeploymentId deployment = new DeploymentId(application, zone);
- List<ProtonMetrics> protonMetrics = controller.serviceRegistry().configServer().getProtonMetrics(deployment);
- return buildResponseFromProtonMetrics(protonMetrics);
+ List<SearchNodeMetrics> searchNodeMetrics = controller.serviceRegistry().configServer().getSearchNodeMetrics(deployment);
+ return buildResponseFromSearchNodeMetrics(searchNodeMetrics);
}
private HttpResponse scaling(String tenantName, String applicationName, String instanceName, String environment, String region, HttpRequest request) {
@@ -1492,11 +1494,11 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler {
return new SlimeJsonResponse(slime);
}
- private JsonResponse buildResponseFromProtonMetrics(List<ProtonMetrics> protonMetrics) {
+ private JsonResponse buildResponseFromSearchNodeMetrics(List<SearchNodeMetrics> searchnodeMetrics) {
try {
var jsonObject = jsonMapper.createObjectNode();
var jsonArray = jsonMapper.createArrayNode();
- for (ProtonMetrics metrics : protonMetrics) {
+ for (SearchNodeMetrics metrics : searchnodeMetrics) {
jsonArray.add(metrics.toJson());
}
jsonObject.set("metrics", jsonArray);
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
index 338e3aba643..d542c06b5bf 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
@@ -6,7 +6,6 @@ import ai.vespa.http.HttpURL.Path;
import ai.vespa.http.HttpURL.Query;
import com.yahoo.component.AbstractComponent;
import com.yahoo.component.Version;
-import com.yahoo.component.annotation.Inject;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.CloudAccount;
import com.yahoo.config.provision.ClusterResources;
@@ -22,12 +21,11 @@ import com.yahoo.config.provision.NodeType;
import com.yahoo.config.provision.ZoneEndpoint.AllowedUrn;
import com.yahoo.config.provision.ZoneEndpoint.AccessType;
import com.yahoo.config.provision.zone.ZoneId;
-import com.yahoo.rdl.UUID;
import com.yahoo.vespa.flags.json.FlagData;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.ClusterMetrics;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.DeploymentData;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.EndpointStatus;
-import com.yahoo.vespa.hosted.controller.api.application.v4.model.ProtonMetrics;
+import com.yahoo.vespa.hosted.controller.api.application.v4.model.SearchNodeMetrics;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.integration.LogEntry;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.ApplicationReindexing;
@@ -70,7 +68,6 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.Random;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Supplier;
@@ -106,7 +103,7 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
private final Map<DeploymentId, TestReport> testReport = new HashMap<>();
private final Map<DeploymentId, CloudAccount> cloudAccounts = new HashMap<>();
private final Map<DeploymentId, List<X509Certificate>> additionalCertificates = new HashMap<>();
- private List<ProtonMetrics> protonMetrics;
+ private List<SearchNodeMetrics> searchnodeMetrics;
private Version lastPrepareVersion = null;
private Consumer<ApplicationId> prepareException = null;
@@ -310,8 +307,8 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
this.clusterMetrics.put(deployment, clusterMetrics);
}
- public void setProtonMetrics(List<ProtonMetrics> protonMetrics) {
- this.protonMetrics = protonMetrics;
+ public void setProtonMetrics(List<SearchNodeMetrics> searchnodeMetrics) {
+ this.searchnodeMetrics = searchnodeMetrics;
}
public void deferLoadBalancerProvisioningIn(Set<Environment> environments) {
@@ -511,8 +508,8 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
}
@Override
- public List<ProtonMetrics> getProtonMetrics(DeploymentId deployment) {
- return this.protonMetrics;
+ public List<SearchNodeMetrics> getSearchNodeMetrics(DeploymentId deployment) {
+ return this.searchnodeMetrics;
}
@Override
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
index 14771906852..9a34989aeff 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
@@ -31,7 +31,7 @@ import com.yahoo.vespa.hosted.controller.ControllerTester;
import com.yahoo.vespa.hosted.controller.Instance;
import com.yahoo.vespa.hosted.controller.LockedTenant;
import com.yahoo.vespa.hosted.controller.api.application.v4.EnvironmentResource;
-import com.yahoo.vespa.hosted.controller.api.application.v4.model.ProtonMetrics;
+import com.yahoo.vespa.hosted.controller.api.application.v4.model.SearchNodeMetrics;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.identifiers.Property;
import com.yahoo.vespa.hosted.controller.api.identifiers.PropertyId;
@@ -1860,20 +1860,20 @@ public class ApplicationApiTest extends ControllerContainerTest {
private void updateMetrics() {
tester.serviceRegistry().configServerMock().setProtonMetrics(List.of(
- (new ProtonMetrics("content/doc/"))
- .addMetric(ProtonMetrics.DOCUMENTS_ACTIVE_COUNT, 11430)
- .addMetric(ProtonMetrics.DOCUMENTS_READY_COUNT, 11430)
- .addMetric(ProtonMetrics.DOCUMENTS_TOTAL_COUNT, 11430)
- .addMetric(ProtonMetrics.DOCUMENT_DISK_USAGE, 44021)
- .addMetric(ProtonMetrics.RESOURCE_DISK_USAGE_AVERAGE, 0.0168421)
- .addMetric(ProtonMetrics.RESOURCE_MEMORY_USAGE_AVERAGE, 0.103482),
- (new ProtonMetrics("content/music/"))
- .addMetric(ProtonMetrics.DOCUMENTS_ACTIVE_COUNT, 32210)
- .addMetric(ProtonMetrics.DOCUMENTS_READY_COUNT, 32000)
- .addMetric(ProtonMetrics.DOCUMENTS_TOTAL_COUNT, 32210)
- .addMetric(ProtonMetrics.DOCUMENT_DISK_USAGE, 90113)
- .addMetric(ProtonMetrics.RESOURCE_DISK_USAGE_AVERAGE, 0.23912)
- .addMetric(ProtonMetrics.RESOURCE_MEMORY_USAGE_AVERAGE, 0.00912)
+ (new SearchNodeMetrics("content/doc/"))
+ .addMetric(SearchNodeMetrics.DOCUMENTS_ACTIVE_COUNT, 11430)
+ .addMetric(SearchNodeMetrics.DOCUMENTS_READY_COUNT, 11430)
+ .addMetric(SearchNodeMetrics.DOCUMENTS_TOTAL_COUNT, 11430)
+ .addMetric(SearchNodeMetrics.DOCUMENT_DISK_USAGE, 44021)
+ .addMetric(SearchNodeMetrics.RESOURCE_DISK_USAGE_AVERAGE, 0.0168421)
+ .addMetric(SearchNodeMetrics.RESOURCE_MEMORY_USAGE_AVERAGE, 0.103482),
+ (new SearchNodeMetrics("content/music/"))
+ .addMetric(SearchNodeMetrics.DOCUMENTS_ACTIVE_COUNT, 32210)
+ .addMetric(SearchNodeMetrics.DOCUMENTS_READY_COUNT, 32000)
+ .addMetric(SearchNodeMetrics.DOCUMENTS_TOTAL_COUNT, 32210)
+ .addMetric(SearchNodeMetrics.DOCUMENT_DISK_USAGE, 90113)
+ .addMetric(SearchNodeMetrics.RESOURCE_DISK_USAGE_AVERAGE, 0.23912)
+ .addMetric(SearchNodeMetrics.RESOURCE_MEMORY_USAGE_AVERAGE, 0.00912)
));
}