Skip to content

Commit

Permalink
Depreceate NodeStatsFixedShardsMetricsCollector in favor of NodeStats…
Browse files Browse the repository at this point in the history
…AllShardsMetricsCollector (opensearch-project#551)

Signed-off-by: Khushboo Rajput <[email protected]>
  • Loading branch information
khushbr authored Oct 2, 2023
1 parent 27a6b56 commit e7713ba
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.6
minimum = 0.5
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import org.opensearch.performanceanalyzer.collectors.FaultDetectionMetricsCollector;
import org.opensearch.performanceanalyzer.collectors.NodeDetailsCollector;
import org.opensearch.performanceanalyzer.collectors.NodeStatsAllShardsMetricsCollector;
import org.opensearch.performanceanalyzer.collectors.NodeStatsFixedShardsMetricsCollector;
import org.opensearch.performanceanalyzer.collectors.SearchBackPressureStatsCollector;
import org.opensearch.performanceanalyzer.collectors.ShardIndexingPressureMetricsCollector;
import org.opensearch.performanceanalyzer.collectors.ShardStateCollector;
Expand Down Expand Up @@ -203,8 +202,6 @@ public PerformanceAnalyzerPlugin(final Settings settings, final java.nio.file.Pa
new NodeDetailsCollector(configOverridesWrapper));
scheduledMetricCollectorsExecutor.addScheduledMetricCollector(
new NodeStatsAllShardsMetricsCollector(performanceAnalyzerController));
scheduledMetricCollectorsExecutor.addScheduledMetricCollector(
new NodeStatsFixedShardsMetricsCollector(performanceAnalyzerController));
scheduledMetricCollectorsExecutor.addScheduledMetricCollector(
new ClusterManagerServiceMetrics());
scheduledMetricCollectorsExecutor.addScheduledMetricCollector(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ public void populatePerShardStats(IndicesService indicesService) {
currentPerShardStats.put(currentIndexShardStats.getShardId(), shardStats);
}
}
return;
}

public void populateMetricValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
import org.opensearch.performanceanalyzer.util.Utils;

/**
* This collector collects metrics for fixed number of shards on a node in a single run. These
* Note: 'NodeStatsAllShardsMetricsCollector' is already released and out of shadow mode, this class
* can be deprecated/removed in future versions.
*
* <p>This collector collects metrics for fixed number of shards on a node in a single run. These
* metrics are heavy which have performance impacts on the performance of the node. The number of
* shards is set via a cluster settings api. The parameter to set is shardsPerCollection. The
* metrics will be populated for these many shards in a single run.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public static void configureMetrics() {
MetricsConfiguration.CONFIG_MAP.put(ThreadPoolMetricsCollector.class, cdefault);
MetricsConfiguration.CONFIG_MAP.put(NodeDetailsCollector.class, cdefault);
MetricsConfiguration.CONFIG_MAP.put(NodeStatsAllShardsMetricsCollector.class, cdefault);
MetricsConfiguration.CONFIG_MAP.put(NodeStatsFixedShardsMetricsCollector.class, cdefault);
MetricsConfiguration.CONFIG_MAP.put(
ClusterManagerServiceEventMetrics.class,
new MetricsConfiguration.MetricConfig(1000, 0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,6 @@ public void testJsonKeyNames() throws NoSuchFieldException, SecurityException {
new MetricDimension[] {},
ShardStatsValue.values(),
getMethodJsonProperty);
verifyMethodWithJsonKeyNames(
NodeStatsFixedShardsMetricsCollector.NodeStatsMetricsFixedShardsPerCollectionStatus
.class,
new MetricDimension[] {},
ShardStatsValue.values(),
getMethodJsonProperty);
verifyNodeDetailJsonKeyNames();
}

private void verifyMethodWithJsonKeyNames(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
Expand All @@ -24,6 +25,11 @@
import org.opensearch.performanceanalyzer.util.TestUtil;
import org.opensearch.test.OpenSearchSingleNodeTestCase;

@Ignore
/**
* Note: 'NodeStatsAllShardsMetricsCollector' is already released and out of shadow mode,
* NodeStatsFixedShardsMetricsCollector class can be deprecated/removed in future versions.
*/
public class NodeStatsFixedShardsMetricsCollectorTests extends OpenSearchSingleNodeTestCase {
private static final String TEST_INDEX = "test";
private static long startTimeInMills = 1153721339;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void testCollectMetrics() throws IOException {

private ThreadPoolStats generateThreadPoolStat(long rejected) {
List<ThreadPoolStats.Stats> stats = new ArrayList<>();
stats.add(new ThreadPoolStats.Stats("write", 0, 0, 0, rejected, 0, 0));
stats.add(new ThreadPoolStats.Stats("write", 0, 0, 0, rejected, 0, 0L, 20L));
return new ThreadPoolStats(stats);
}

Expand Down

0 comments on commit e7713ba

Please sign in to comment.