From d7250c5fc97d135e08f51091d7f457a08553a9f9 Mon Sep 17 00:00:00 2001 From: Gagan Juneja Date: Sun, 21 Apr 2024 18:29:36 +0530 Subject: [PATCH] test changes for PA Signed-off-by: Gagan Juneja --- .../java/org/opensearch/cluster/service/ClusterService.java | 6 ++++++ server/src/main/java/org/opensearch/node/Node.java | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/opensearch/cluster/service/ClusterService.java b/server/src/main/java/org/opensearch/cluster/service/ClusterService.java index aa7766979e851..591344e9e20d8 100644 --- a/server/src/main/java/org/opensearch/cluster/service/ClusterService.java +++ b/server/src/main/java/org/opensearch/cluster/service/ClusterService.java @@ -69,6 +69,8 @@ public class ClusterService extends AbstractLifecycleComponent { private final ClusterApplierService clusterApplierService; + private MetricsRegistry metricsRegistry; + public static final org.opensearch.common.settings.Setting.AffixSetting USER_DEFINED_METADATA = Setting.prefixKeySetting( "cluster.metadata.", (key) -> Setting.simpleString(key, Property.Dynamic, Property.NodeScope) @@ -117,6 +119,10 @@ public ClusterService( this.clusterApplierService = clusterApplierService; } + public MetricsRegistry setMetricsRegistry(MetricsRegistry metricsRegistry) { + return this.metricsRegistry = metricsRegistry; + } + public synchronized void setNodeConnectionsService(NodeConnectionsService nodeConnectionsService) { clusterApplierService.setNodeConnectionsService(nodeConnectionsService); } diff --git a/server/src/main/java/org/opensearch/node/Node.java b/server/src/main/java/org/opensearch/node/Node.java index a33fd71e21896..31379cfa1d920 100644 --- a/server/src/main/java/org/opensearch/node/Node.java +++ b/server/src/main/java/org/opensearch/node/Node.java @@ -637,9 +637,9 @@ protected Node( tracerFactory = new NoopTracerFactory(); metricsRegistryFactory = new NoopMetricsRegistryFactory(); } - tracer = tracerFactory.getTracer(); metricsRegistry = metricsRegistryFactory.getMetricsRegistry(); + clusterService.setMetricsRegistry(metricsRegistry); resourcesToClose.add(tracer::close); resourcesToClose.add(metricsRegistry::close);