Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test commit adding a new ctor for MasterService API class
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Garg <gkharsh@amazon.com>
Harsh Garg committed Jun 10, 2024
1 parent 13d5830 commit 2850916
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -8,9 +8,11 @@

package org.opensearch.cluster.service;

import org.opensearch.cluster.ClusterManagerMetrics;
import org.opensearch.common.annotation.PublicApi;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Settings;
import org.opensearch.telemetry.metrics.noop.NoopMetricsRegistry;
import org.opensearch.threadpool.ThreadPool;

/**
@@ -21,6 +23,15 @@
@PublicApi(since = "2.2.0")
public class ClusterManagerService extends MasterService {
public ClusterManagerService(Settings settings, ClusterSettings clusterSettings, ThreadPool threadPool) {
super(settings, clusterSettings, threadPool);
this(settings, clusterSettings, threadPool, new ClusterManagerMetrics(NoopMetricsRegistry.INSTANCE));
}

public ClusterManagerService(
Settings settings,
ClusterSettings clusterSettings,
ThreadPool threadPool,
ClusterManagerMetrics clusterManagerMetrics
) {
super(settings, clusterSettings, threadPool, clusterManagerMetrics);
}
}
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@
import org.opensearch.action.support.PlainActionFuture;
import org.opensearch.cluster.AckedClusterStateTaskListener;
import org.opensearch.cluster.ClusterChangedEvent;
import org.opensearch.cluster.ClusterManagerMetrics;
import org.opensearch.cluster.ClusterState;
import org.opensearch.cluster.ClusterState.Builder;
import org.opensearch.cluster.ClusterStateTaskConfig;
@@ -136,7 +137,14 @@ public class MasterService extends AbstractLifecycleComponent {
private final ClusterManagerThrottlingStats throttlingStats;
private final ClusterStateStats stateStats;

public MasterService(Settings settings, ClusterSettings clusterSettings, ThreadPool threadPool) {
private final ClusterManagerMetrics clusterManagerMetrics;

public MasterService(
Settings settings,
ClusterSettings clusterSettings,
ThreadPool threadPool,
ClusterManagerMetrics clusterManagerMetrics
) {
this.nodeName = Objects.requireNonNull(Node.NODE_NAME_SETTING.get(settings));

this.slowTaskLoggingThreshold = CLUSTER_MANAGER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.get(settings);
@@ -154,6 +162,7 @@ public MasterService(Settings settings, ClusterSettings clusterSettings, ThreadP
);
this.stateStats = new ClusterStateStats();
this.threadPool = threadPool;
this.clusterManagerMetrics = clusterManagerMetrics;
}

private void setSlowTaskLoggingThreshold(TimeValue slowTaskLoggingThreshold) {

0 comments on commit 2850916

Please sign in to comment.