diff options
author | gjoranv <gv@verizonmedia.com> | 2020-06-30 13:03:44 +0200 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2020-06-30 13:08:57 +0200 |
commit | 96af74696fc75b262ffe1ad3326db10b8ba6dae5 (patch) | |
tree | b53e1fc8df14447152d5e7cfed157eb37b6b6cca /config-model | |
parent | 2eb570673a17c0c1805743006386f4df8fb0caae (diff) |
Add bindings for prometheus handler in application containers.
+ Simplify by using common path for json and prometheus in the
internal applicationmetrics api.
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java | 18 | ||||
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/container/http/AccessControl.java | 3 |
2 files changed, 16 insertions, 5 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java index 234387f5a6b..04fe77d9e05 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java @@ -13,6 +13,7 @@ import com.yahoo.container.bundle.BundleInstantiationSpecification; import com.yahoo.container.handler.ThreadpoolConfig; import com.yahoo.container.handler.metrics.MetricsProxyApiConfig; import com.yahoo.container.handler.metrics.MetricsV2Handler; +import com.yahoo.container.handler.metrics.PrometheusV1Handler; import com.yahoo.container.jdisc.ContainerMbusConfig; import com.yahoo.container.jdisc.messagebus.MbusServerProvider; import com.yahoo.jdisc.http.ServletPathsConfig; @@ -58,6 +59,10 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat public static final String METRICS_V2_HANDLER_BINDING_1 = "http://*" + MetricsV2Handler.V2_PATH; public static final String METRICS_V2_HANDLER_BINDING_2 = METRICS_V2_HANDLER_BINDING_1 + "/*"; + public static final String PROMETHEUS_V1_HANDLER_CLASS = PrometheusV1Handler.class.getName(); + private static final String PROMETHEUS_V1_HANDLER_BINDING_1 = "http://*" + PrometheusV1Handler.V1_PATH; + private static final String PROMETHEUS_V1_HANDLER_BINDING_2 = PROMETHEUS_V1_HANDLER_BINDING_1 + "/*"; + public static final int heapSizePercentageOfTotalNodeMemory = 60; public static final int heapSizePercentageOfTotalNodeMemoryWhenCombinedCluster = 17; @@ -88,7 +93,7 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat addSimpleComponent("com.yahoo.container.jdisc.CertificateStoreProvider"); addSimpleComponent("com.yahoo.container.jdisc.AthenzIdentityProviderProvider"); addSimpleComponent("com.yahoo.container.jdisc.SystemInfoProvider"); - addMetricsV2Handler(); + addMetricsHandlers(); addTestrunnerComponentsIfTester(deployState); } @@ -116,10 +121,15 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat } } - public void addMetricsV2Handler() { + private void addMetricsHandlers() { + addMetricsHandler(METRICS_V2_HANDLER_CLASS, METRICS_V2_HANDLER_BINDING_1, METRICS_V2_HANDLER_BINDING_2); + addMetricsHandler(PROMETHEUS_V1_HANDLER_CLASS, PROMETHEUS_V1_HANDLER_BINDING_1, PROMETHEUS_V1_HANDLER_BINDING_2); + } + + private void addMetricsHandler(String handlerClass, String rootBinding, String innerBinding) { Handler<AbstractConfigProducer<?>> handler = new Handler<>( - new ComponentModel(METRICS_V2_HANDLER_CLASS, null, null, null)); - handler.addServerBindings(METRICS_V2_HANDLER_BINDING_1, METRICS_V2_HANDLER_BINDING_2); + new ComponentModel(handlerClass, null, null, null)); + handler.addServerBindings(rootBinding, innerBinding); addComponent(handler); } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/http/AccessControl.java b/config-model/src/main/java/com/yahoo/vespa/model/container/http/AccessControl.java index dd48e65c340..9676b8b1e4a 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/http/AccessControl.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/http/AccessControl.java @@ -35,7 +35,8 @@ public final class AccessControl { ContainerCluster.BINDINGS_OVERVIEW_HANDLER_CLASS, ContainerCluster.STATE_HANDLER_CLASS, ContainerCluster.LOG_HANDLER_CLASS, - ApplicationContainerCluster.METRICS_V2_HANDLER_CLASS + ApplicationContainerCluster.METRICS_V2_HANDLER_CLASS, + ApplicationContainerCluster.PROMETHEUS_V1_HANDLER_CLASS ); public static final class Builder { |