aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <jonbratseth@yahoo.com>2018-01-07 21:25:46 +0100
committerGitHub <noreply@github.com>2018-01-07 21:25:46 +0100
commitdd269359308af49ec4ffd73e7cd0fc4659e8a506 (patch)
treea3165e9081542a019445585890a90ebd7cda239f
parent2c19d9340e817bbbbe1054239789478c326b07c8 (diff)
parentf7472440472c647ba1def181c57d00689670e877 (diff)
Merge pull request #4562 from vespa-engine/arnej/add-metric-for-more-handlers
Arnej/add metric for more handlers
-rw-r--r--clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2Handler.java14
-rw-r--r--clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandler.java13
-rw-r--r--clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2HandlerTest.java5
-rw-r--r--clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandlerTest.java5
-rw-r--r--clustercontroller-apputil/src/main/java/com/yahoo/vespa/clustercontroller/apputil/communication/http/JDiscHttpRequestHandler.java6
-rw-r--r--container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/RootHandler.java6
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java7
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiHandler.java6
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java6
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiHandler.java6
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiHandler.java6
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiHandler.java6
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/restapi/RestApiHandler.java4
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodesApiHandler.java7
-rw-r--r--vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java11
-rw-r--r--vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandler.java12
-rw-r--r--vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandlerV3.java10
-rw-r--r--vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/FeedHandlerTest.java5
-rw-r--r--vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/v3/FeedTesterV3.java6
-rw-r--r--vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2ErrorsInResultTestCase.java5
-rw-r--r--vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2ExternalFeedTestCase.java5
-rw-r--r--vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2FailingMessagebusTestCase.java3
-rw-r--r--vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2NoXmlReaderTestCase.java3
24 files changed, 79 insertions, 81 deletions
diff --git a/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2Handler.java b/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2Handler.java
index eea085bd103..7f0acd83b0d 100644
--- a/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2Handler.java
+++ b/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2Handler.java
@@ -3,7 +3,6 @@ package com.yahoo.vespa.clustercontroller.apps.clustercontroller;
import com.google.inject.Inject;
import com.yahoo.cloud.config.ClusterInfoConfig;
-import com.yahoo.container.logging.AccessLog;
import com.yahoo.log.LogLevel;
import com.yahoo.vespa.clustercontroller.apputil.communication.http.JDiscHttpRequestHandler;
import com.yahoo.vespa.clustercontroller.core.restapiv2.ClusterControllerStateRestAPI;
@@ -13,19 +12,22 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
-import java.util.concurrent.Executor;
import java.util.logging.Logger;
public class StateRestApiV2Handler extends JDiscHttpRequestHandler {
private static final Logger log = Logger.getLogger(StateRestApiV2Handler.class.getName());
@Inject
- public StateRestApiV2Handler(Executor executor, ClusterController cc, ClusterInfoConfig config, AccessLog accessLog) {
- this(executor, new ClusterControllerStateRestAPI(cc, getClusterControllerSockets(config)), "/cluster/v2", accessLog);
+ public StateRestApiV2Handler(ClusterController cc, ClusterInfoConfig config,
+ JDiscHttpRequestHandler.Context ctx)
+ {
+ this(new ClusterControllerStateRestAPI(cc, getClusterControllerSockets(config)), "/cluster/v2", ctx);
}
- private StateRestApiV2Handler(Executor executor, ClusterControllerStateRestAPI restApi, String pathPrefix, AccessLog accessLog) {
- super(new RestApiHandler(restApi).setDefaultPathPrefix(pathPrefix), executor, accessLog);
+ private StateRestApiV2Handler(ClusterControllerStateRestAPI restApi, String pathPrefix,
+ JDiscHttpRequestHandler.Context ctx)
+ {
+ super(new RestApiHandler(restApi).setDefaultPathPrefix(pathPrefix), ctx);
}
// This method is package-private instead of private to be accessible to unit-tests.
diff --git a/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandler.java b/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandler.java
index ae7c32e0f95..6817a033675 100644
--- a/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandler.java
+++ b/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandler.java
@@ -2,22 +2,21 @@
package com.yahoo.vespa.clustercontroller.apps.clustercontroller;
import com.google.inject.Inject;
-import com.yahoo.container.logging.AccessLog;
import com.yahoo.vespa.clustercontroller.apputil.communication.http.JDiscHttpRequestHandler;
-import java.util.concurrent.Executor;
-
public class StatusHandler extends JDiscHttpRequestHandler {
private final com.yahoo.vespa.clustercontroller.core.status.StatusHandler statusHandler;
@Inject
- public StatusHandler(ClusterController fc, Executor executor, AccessLog accessLog) {
- this(new com.yahoo.vespa.clustercontroller.core.status.StatusHandler(fc), executor, accessLog);
+ public StatusHandler(ClusterController fc, JDiscHttpRequestHandler.Context ctx) {
+ this(new com.yahoo.vespa.clustercontroller.core.status.StatusHandler(fc), ctx);
}
- private StatusHandler(com.yahoo.vespa.clustercontroller.core.status.StatusHandler handler, Executor executor, AccessLog accessLog) {
- super(handler, executor, accessLog);
+ private StatusHandler(com.yahoo.vespa.clustercontroller.core.status.StatusHandler handler,
+ JDiscHttpRequestHandler.Context ctx)
+ {
+ super(handler, ctx);
this.statusHandler = handler;
}
diff --git a/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2HandlerTest.java b/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2HandlerTest.java
index 524aba1398b..dbc7834a601 100644
--- a/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2HandlerTest.java
+++ b/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StateRestApiV2HandlerTest.java
@@ -2,7 +2,6 @@
package com.yahoo.vespa.clustercontroller.apps.clustercontroller;
import com.yahoo.cloud.config.ClusterInfoConfig;
-import com.yahoo.container.logging.AccessLog;
import com.yahoo.vespa.clustercontroller.core.restapiv2.ClusterControllerStateRestAPI;
import junit.framework.TestCase;
@@ -15,13 +14,11 @@ import java.util.concurrent.TimeUnit;
public class StateRestApiV2HandlerTest extends TestCase {
public void testNoMatchingSockets() {
- ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 100, 100, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(1000));
ClusterController controller = new ClusterController();
ClusterInfoConfig config = new ClusterInfoConfig(
new ClusterInfoConfig.Builder().clusterId("cluster-id").nodeCount(1));
ClusterInfoConfig.Builder clusterConfig = new ClusterInfoConfig.Builder();
- new StateRestApiV2Handler(executor, controller, config, AccessLog.voidAccessLog());
- executor.shutdown();
+ new StateRestApiV2Handler(controller, config, StateRestApiV2Handler.testOnlyContext());
}
public void testMappingOfIndexToClusterControllers() {
diff --git a/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandlerTest.java b/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandlerTest.java
index 66cb477e793..49e0a637368 100644
--- a/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandlerTest.java
+++ b/clustercontroller-apps/src/test/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/StatusHandlerTest.java
@@ -1,7 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.apps.clustercontroller;
-import com.yahoo.container.logging.AccessLog;
import junit.framework.TestCase;
import java.util.concurrent.ArrayBlockingQueue;
@@ -12,9 +11,7 @@ public class StatusHandlerTest extends TestCase {
public void testSimple() {
ClusterController controller = new ClusterController();
- ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 100, 100, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(1000));
- StatusHandler handler = new StatusHandler(controller, executor, AccessLog.voidAccessLog());
- executor.shutdown();
+ StatusHandler handler = new StatusHandler(controller, StatusHandler.testOnlyContext());
}
}
diff --git a/clustercontroller-apputil/src/main/java/com/yahoo/vespa/clustercontroller/apputil/communication/http/JDiscHttpRequestHandler.java b/clustercontroller-apputil/src/main/java/com/yahoo/vespa/clustercontroller/apputil/communication/http/JDiscHttpRequestHandler.java
index f43f04d1aac..2029630a5de 100644
--- a/clustercontroller-apputil/src/main/java/com/yahoo/vespa/clustercontroller/apputil/communication/http/JDiscHttpRequestHandler.java
+++ b/clustercontroller-apputil/src/main/java/com/yahoo/vespa/clustercontroller/apputil/communication/http/JDiscHttpRequestHandler.java
@@ -2,7 +2,6 @@
package com.yahoo.vespa.clustercontroller.apputil.communication.http;
import com.yahoo.container.jdisc.LoggingRequestHandler;
-import com.yahoo.container.logging.AccessLog;
import com.yahoo.jdisc.HeaderFields;
import com.yahoo.jdisc.Response;
import com.yahoo.jdisc.handler.CompletionHandler;
@@ -14,7 +13,6 @@ import org.apache.commons.io.IOUtils;
import java.io.*;
import java.time.Duration;
-import java.util.concurrent.Executor;
import java.util.logging.Logger;
/**
@@ -29,8 +27,8 @@ public class JDiscHttpRequestHandler extends LoggingRequestHandler {
private static final Logger log = Logger.getLogger(JDiscHttpRequestHandler.class.getName());
private final HttpRequestHandler requestHandler;
- public JDiscHttpRequestHandler(HttpRequestHandler handler, Executor executor, AccessLog accessLog) {
- super(executor, accessLog);
+ public JDiscHttpRequestHandler(HttpRequestHandler handler, LoggingRequestHandler.Context parentCtx) {
+ super(parentCtx);
this.requestHandler = handler;
}
diff --git a/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java b/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java
index 4f365ebbab3..933751fd9ad 100644
--- a/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java
+++ b/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java
@@ -50,6 +50,9 @@ public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler {
this.accessLog = other.accessLog;
this.metric = other.metric;
}
+ public Executor getExecutor() { return executor; }
+ public AccessLog getAccessLog() { return accessLog; }
+ public Metric getMetric() { return metric; }
}
public static Context testOnlyContext() {
return new Context(new Executor() {
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/RootHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/RootHandler.java
index 50c4efc2d27..89baa1cfa39 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/RootHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/RootHandler.java
@@ -9,12 +9,10 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.container.jdisc.LoggingRequestHandler;
-import com.yahoo.container.logging.AccessLog;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;
-import java.util.concurrent.Executor;
/**
* Responds to requests for the root path of the controller by listing the available web service API's.
@@ -28,8 +26,8 @@ import java.util.concurrent.Executor;
*/
public class RootHandler extends LoggingRequestHandler {
- public RootHandler(Executor executor, AccessLog accessLog) {
- super(executor, accessLog);
+ public RootHandler(LoggingRequestHandler.Context parentCtx) {
+ super(parentCtx);
}
@Override
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 a7d072d1dae..21230cb8e0d 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
@@ -14,7 +14,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId;
import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.container.jdisc.LoggingRequestHandler;
-import com.yahoo.container.logging.AccessLog;
import com.yahoo.io.IOUtils;
import com.yahoo.log.LogLevel;
import com.yahoo.slime.Cursor;
@@ -94,7 +93,6 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Scanner;
-import java.util.concurrent.Executor;
import java.util.logging.Level;
/**
@@ -112,9 +110,10 @@ public class ApplicationApiHandler extends LoggingRequestHandler {
private final AthenzClientFactory athenzClientFactory;
@Inject
- public ApplicationApiHandler(Executor executor, AccessLog accessLog, Controller controller, Authorizer authorizer,
+ public ApplicationApiHandler(LoggingRequestHandler.Context parentCtx,
+ Controller controller, Authorizer authorizer,
AthenzClientFactory athenzClientFactory) {
- super(executor, accessLog);
+ super(parentCtx);
this.controller = controller;
this.authorizer = authorizer;
this.athenzClientFactory = athenzClientFactory;
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiHandler.java
index 162827cdb99..a9eaaf4048c 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiHandler.java
@@ -4,7 +4,6 @@ package com.yahoo.vespa.hosted.controller.restapi.controller;
import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.container.jdisc.LoggingRequestHandler;
-import com.yahoo.container.logging.AccessLog;
import com.yahoo.io.IOUtils;
import com.yahoo.slime.Inspector;
import com.yahoo.text.Utf8;
@@ -20,7 +19,6 @@ import com.yahoo.yolean.Exceptions;
import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
-import java.util.concurrent.Executor;
import java.util.logging.Level;
/**
@@ -34,8 +32,8 @@ public class ControllerApiHandler extends LoggingRequestHandler {
private final ControllerMaintenance maintenance;
- public ControllerApiHandler(Executor executor, AccessLog accessLog, ControllerMaintenance maintenance) {
- super(executor, accessLog);
+ public ControllerApiHandler(LoggingRequestHandler.Context parentCtx, ControllerMaintenance maintenance) {
+ super(parentCtx);
this.maintenance = maintenance;
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java
index 27b219cd892..8338d341a2b 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java
@@ -7,7 +7,6 @@ import com.yahoo.config.provision.ApplicationId;
import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.container.jdisc.LoggingRequestHandler;
-import com.yahoo.container.logging.AccessLog;
import com.yahoo.slime.Cursor;
import com.yahoo.slime.Slime;
import com.yahoo.vespa.hosted.controller.Application;
@@ -23,7 +22,6 @@ import com.yahoo.vespa.hosted.controller.restapi.Path;
import com.yahoo.yolean.Exceptions;
import java.util.Optional;
-import java.util.concurrent.Executor;
import java.util.logging.Level;
import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobError.outOfCapacity;
@@ -40,8 +38,8 @@ public class DeploymentApiHandler extends LoggingRequestHandler {
private final Controller controller;
- public DeploymentApiHandler(Executor executor, AccessLog accessLog, Controller controller) {
- super(executor, accessLog);
+ public DeploymentApiHandler(LoggingRequestHandler.Context parentCtx, Controller controller) {
+ super(parentCtx);
this.controller = controller;
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiHandler.java
index 4d4f01bc1a6..17181950a29 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiHandler.java
@@ -5,7 +5,6 @@ import com.yahoo.config.provision.ApplicationId;
import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.container.jdisc.LoggingRequestHandler;
-import com.yahoo.container.logging.AccessLog;
import com.yahoo.io.IOUtils;
import com.yahoo.jdisc.http.HttpRequest.Method;
import com.yahoo.slime.Cursor;
@@ -29,7 +28,6 @@ import java.io.InputStream;
import java.util.List;
import java.util.Optional;
import java.util.Scanner;
-import java.util.concurrent.Executor;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -47,8 +45,8 @@ public class ScrewdriverApiHandler extends LoggingRequestHandler {
private final Controller controller;
- public ScrewdriverApiHandler(Executor executor, AccessLog accessLog, Controller controller) {
- super(executor, accessLog);
+ public ScrewdriverApiHandler(LoggingRequestHandler.Context parentCtx, Controller controller) {
+ super(parentCtx);
this.controller = controller;
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiHandler.java
index 282dd79b317..f38ea14bbd8 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiHandler.java
@@ -7,7 +7,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId;
import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.container.jdisc.LoggingRequestHandler;
-import com.yahoo.container.logging.AccessLog;
import com.yahoo.slime.Cursor;
import com.yahoo.slime.Slime;
import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry;
@@ -18,7 +17,6 @@ import com.yahoo.yolean.Exceptions;
import java.util.Comparator;
import java.util.List;
-import java.util.concurrent.Executor;
import java.util.logging.Level;
import java.util.stream.Collectors;
@@ -32,8 +30,8 @@ public class ZoneApiHandler extends LoggingRequestHandler {
private final ZoneRegistry zoneRegistry;
- public ZoneApiHandler(Executor executor, AccessLog accessLog, ZoneRegistry zoneRegistry) {
- super(executor, accessLog);
+ public ZoneApiHandler(LoggingRequestHandler.Context parentCtx, ZoneRegistry zoneRegistry) {
+ super(parentCtx);
this.zoneRegistry = zoneRegistry;
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiHandler.java
index 68dc2325687..21c7000ef6a 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiHandler.java
@@ -5,7 +5,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId;
import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.container.jdisc.LoggingRequestHandler;
-import com.yahoo.container.logging.AccessLog;
import com.yahoo.slime.Cursor;
import com.yahoo.slime.Slime;
import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry;
@@ -18,7 +17,6 @@ import com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse;
import com.yahoo.yolean.Exceptions;
import java.io.IOException;
-import java.util.concurrent.Executor;
import java.util.logging.Level;
/**
@@ -34,9 +32,9 @@ public class ZoneApiHandler extends LoggingRequestHandler {
private final ZoneRegistry zoneRegistry;
private final ConfigServerRestExecutor proxy;
- public ZoneApiHandler(Executor executor, AccessLog accessLog, ZoneRegistry zoneRegistry,
+ public ZoneApiHandler(LoggingRequestHandler.Context parentCtx, ZoneRegistry zoneRegistry,
ConfigServerRestExecutor proxy) {
- super(executor, accessLog);
+ super(parentCtx);
this.zoneRegistry = zoneRegistry;
this.proxy = proxy;
}
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/restapi/RestApiHandler.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/restapi/RestApiHandler.java
index 42b36d95374..03217c85329 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/restapi/RestApiHandler.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/restapi/RestApiHandler.java
@@ -37,10 +37,10 @@ public class RestApiHandler extends LoggingRequestHandler{
private final MetricReceiverWrapper metricReceiverWrapper;
@Inject
- public RestApiHandler(Executor executor, AccessLog accessLog,
+ public RestApiHandler(LoggingRequestHandler.Context parentCtx,
NodeAdminStateUpdater nodeAdminStateUpdater,
MetricReceiverWrapper metricReceiverWrapper) {
- super(executor, accessLog);
+ super(parentCtx);
this.refresher = nodeAdminStateUpdater;
this.metricReceiverWrapper = metricReceiverWrapper;
}
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodesApiHandler.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodesApiHandler.java
index b47b3544d17..b188ae7fb20 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodesApiHandler.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodesApiHandler.java
@@ -38,6 +38,7 @@ import java.util.Set;
import java.util.concurrent.Executor;
import java.util.logging.Level;
import java.util.stream.Collectors;
+import javax.inject.Inject;
import static com.yahoo.vespa.config.SlimeUtils.optionalString;
@@ -55,11 +56,11 @@ public class NodesApiHandler extends LoggingRequestHandler {
private final NodeFlavors nodeFlavors;
private static final String nodeTypeKey = "type";
-
- public NodesApiHandler(Executor executor, AccessLog accessLog, Orchestrator orchestrator,
+ @Inject
+ public NodesApiHandler(LoggingRequestHandler.Context parentCtx, Orchestrator orchestrator,
NodeRepository nodeRepository,
NodeRepositoryMaintenance maintenance, NodeFlavors flavors) {
- super(executor, accessLog);
+ super(parentCtx);
this.orchestrator = orchestrator;
this.nodeRepository = nodeRepository;
this.maintenance = maintenance;
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java
index 5e0fea8ab7d..d5d6a0dc40b 100644
--- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java
+++ b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/RestApi.java
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.inject.Inject;
import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.yahoo.jdisc.Metric;
import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.container.jdisc.HttpResponse;
@@ -60,9 +61,11 @@ public class RestApi extends LoggingRequestHandler {
private final AtomicInteger threadsAvailableForApi;
@Inject
- public RestApi(Executor executor, AccessLog accessLog, DocumentmanagerConfig documentManagerConfig,
- LoadTypeConfig loadTypeConfig, ThreadpoolConfig threadpoolConfig, MetricReceiver metricReceiver) {
- super(executor, accessLog);
+ public RestApi(LoggingRequestHandler.Context parentCtx, DocumentmanagerConfig documentManagerConfig,
+ LoadTypeConfig loadTypeConfig, ThreadpoolConfig threadpoolConfig,
+ MetricReceiver metricReceiver)
+ {
+ super(parentCtx);
MessageBusParams params = new MessageBusParams(new LoadTypeSet(loadTypeConfig));
params.setDocumentmanagerConfig(documentManagerConfig);
this.operationHandler = new OperationHandlerImpl(new MessageBusDocumentAccess(params), metricReceiver);
@@ -82,7 +85,7 @@ public class RestApi extends LoggingRequestHandler {
AccessLog accessLog,
OperationHandler operationHandler,
int threadsAvailable) {
- super(executor, accessLog);
+ super(executor, accessLog, null);
this.operationHandler = operationHandler;
this.threadsAvailableForApi = new AtomicInteger(threadsAvailable);
}
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandler.java b/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandler.java
index ddc652dedbb..61ff84cfdaa 100644
--- a/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandler.java
+++ b/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandler.java
@@ -61,24 +61,22 @@ public class FeedHandler extends LoggingRequestHandler {
@Inject
public FeedHandler(
- Executor executor,
+ LoggingRequestHandler.Context parentCtx,
DocumentmanagerConfig documentManagerConfig,
SessionCache sessionCache,
- Metric metric,
- AccessLog accessLog,
ThreadpoolConfig threadpoolConfig,
MetricReceiver metricReceiver) throws Exception {
- super(executor, accessLog, metric);
+ super(parentCtx);
DocumentApiMetrics metricsHelper = new DocumentApiMetrics(metricReceiver, "vespa.http.server");
- feedHandlerV3 = new FeedHandlerV3(executor, documentManagerConfig, sessionCache, metric, accessLog, threadpoolConfig, metricsHelper);
+ feedHandlerV3 = new FeedHandlerV3(parentCtx, documentManagerConfig, sessionCache, threadpoolConfig, metricsHelper);
docTypeManager = createDocumentManager(documentManagerConfig);
clients = new HashMap<>();
this.sessionCache = sessionCache;
sessionId = new AtomicLong(new Random(System.currentTimeMillis()).nextLong());
- feedReplyHandler = new FeedReplyReader(metric, metricsHelper);
+ feedReplyHandler = new FeedReplyReader(parentCtx.getMetric(), metricsHelper);
cron = new ScheduledThreadPoolExecutor(1, ThreadFactoryFactory.getThreadFactory("feedhandler.cron"));
cron.scheduleWithFixedDelay(new CleanClients(), 16, 11, TimeUnit.MINUTES);
- this.metric = metric;
+ this.metric = parentCtx.getMetric();
this.localHostname = resolveLocalHostname();
}
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandlerV3.java b/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandlerV3.java
index 28bcb50a144..4cb82e74db6 100644
--- a/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandlerV3.java
+++ b/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandlerV3.java
@@ -49,20 +49,18 @@ public class FeedHandlerV3 extends LoggingRequestHandler {
private static final Logger log = Logger.getLogger(FeedHandlerV3.class.getName());
public FeedHandlerV3(
- Executor executor,
+ LoggingRequestHandler.Context parentCtx,
DocumentmanagerConfig documentManagerConfig,
SessionCache sessionCache,
- Metric metric,
- AccessLog accessLog,
ThreadpoolConfig threadpoolConfig,
DocumentApiMetrics metricsHelper) throws Exception {
- super(executor, accessLog, metric);
+ super(parentCtx);
docTypeManager = new DocumentTypeManager(documentManagerConfig);
this.sessionCache = sessionCache;
- feedReplyHandler = new FeedReplyReader(metric, metricsHelper);
+ feedReplyHandler = new FeedReplyReader(parentCtx.getMetric(), metricsHelper);
cron = new ScheduledThreadPoolExecutor(1, ThreadFactoryFactory.getThreadFactory("feedhandlerv3.cron"));
cron.scheduleWithFixedDelay(this::removeOldClients, 16, 11, TimeUnit.MINUTES);
- this.metric = metric;
+ this.metric = parentCtx.getMetric();
// 40% of the threads can be blocking on feeding before we deny requests.
if (threadpoolConfig != null) {
threadsAvailableForFeeding = new AtomicInteger(Math.max((int) (0.4 * threadpoolConfig.maxthreads()), 1));
diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/FeedHandlerTest.java b/vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/FeedHandlerTest.java
index a3d4da1c60c..c0cc907c671 100644
--- a/vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/FeedHandlerTest.java
+++ b/vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/FeedHandlerTest.java
@@ -39,7 +39,10 @@ public class FeedHandlerTest {
private final CountDownLatch countDownLatch = new CountDownLatch(1);
public TestFeedHandler() throws Exception {
- super(Executors.newCachedThreadPool(), null, null, mock(Metric.class), mock(AccessLog.class), null, MetricReceiver.nullImplementation);
+ super(new FeedHandler.Context(Executors.newCachedThreadPool(),
+ mock(AccessLog.class),
+ mock(Metric.class)),
+ null, null, null, MetricReceiver.nullImplementation);
}
/**
diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/v3/FeedTesterV3.java b/vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/v3/FeedTesterV3.java
index e237978878e..b5c3998432c 100644
--- a/vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/v3/FeedTesterV3.java
+++ b/vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/v3/FeedTesterV3.java
@@ -101,7 +101,11 @@ public class FeedTesterV3 {
Executor threadPool = Executors.newCachedThreadPool();
DocumentmanagerConfig docMan = new DocumentmanagerConfig(new DocumentmanagerConfig.Builder().enablecompression(true));
FeedHandlerV3 feedHandlerV3 = new FeedHandlerV3(
- threadPool, docMan, null /* session cache */ , new NullFeedMetric(), AccessLog.voidAccessLog(), null, new DocumentApiMetrics(MetricReceiver.nullImplementation, "test")) {
+ new FeedHandlerV3.Context(threadPool, AccessLog.voidAccessLog(), new NullFeedMetric()),
+ docMan,
+ null /* session cache */,
+ null /* thread pool config */,
+ new DocumentApiMetrics(MetricReceiver.nullImplementation, "test")) {
@Override
protected ReferencedResource<SharedSourceSession> retainSource(
SessionCache sessionCache, SourceSessionParams sessionParams) {
diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2ErrorsInResultTestCase.java b/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2ErrorsInResultTestCase.java
index f1cf9b2cfa1..47745b29032 100644
--- a/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2ErrorsInResultTestCase.java
+++ b/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2ErrorsInResultTestCase.java
@@ -60,7 +60,10 @@ public class V2ErrorsInResultTestCase {
private static class LessConfiguredHandler extends FeedHandler {
public LessConfiguredHandler(Executor executor) throws Exception {
- super(executor, null, null, new DummyMetric(), AccessLog.voidAccessLog(), null, MetricReceiver.nullImplementation);
+ super(new FeedHandler.Context(executor,
+ AccessLog.voidAccessLog(),
+ new DummyMetric()),
+ null, null, null, MetricReceiver.nullImplementation);
}
diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2ExternalFeedTestCase.java b/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2ExternalFeedTestCase.java
index a0eb1323c53..9960d98f7f1 100644
--- a/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2ExternalFeedTestCase.java
+++ b/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2ExternalFeedTestCase.java
@@ -115,7 +115,10 @@ public class V2ExternalFeedTestCase {
volatile DataFormat lastFormatSeen;
public LessConfiguredHandler(Executor executor) throws Exception {
- super(executor, null, null, new DummyMetric(), AccessLog.voidAccessLog(), null, MetricReceiver.nullImplementation);
+ super(new FeedHandler.Context(executor,
+ AccessLog.voidAccessLog(),
+ new DummyMetric()),
+ null, null, null, MetricReceiver.nullImplementation);
}
@Override
diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2FailingMessagebusTestCase.java b/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2FailingMessagebusTestCase.java
index 8e8da1bed99..6290c22f694 100644
--- a/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2FailingMessagebusTestCase.java
+++ b/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2FailingMessagebusTestCase.java
@@ -61,7 +61,8 @@ public class V2FailingMessagebusTestCase {
private class LessConfiguredHandler extends FeedHandler {
public LessConfiguredHandler(Executor executor) throws Exception {
- super(executor, null, null, new DummyMetric(), AccessLog.voidAccessLog(), null, MetricReceiver.nullImplementation);
+ super(new FeedHandler.Context(executor, AccessLog.voidAccessLog(), new DummyMetric()),
+ null, null, null, MetricReceiver.nullImplementation);
}
@Override
diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2NoXmlReaderTestCase.java b/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2NoXmlReaderTestCase.java
index c044a5963cb..633477dcc79 100644
--- a/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2NoXmlReaderTestCase.java
+++ b/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2NoXmlReaderTestCase.java
@@ -58,7 +58,8 @@ public class V2NoXmlReaderTestCase {
private static class LessConfiguredHandler extends FeedHandler {
public LessConfiguredHandler(Executor executor) throws Exception {
- super(executor, null, null, new DummyMetric(), AccessLog.voidAccessLog(), null, MetricReceiver.nullImplementation);
+ super(new FeedHandler.Context(executor, AccessLog.voidAccessLog(), new DummyMetric()),
+ null, null, null, MetricReceiver.nullImplementation);
}