Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Depreceate NodeStatsFixedShardsMetricsCollector in favor of NodeStatsAllShardsMetricsCollector #551

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better not to reduce coverage percentage

Copy link
Collaborator Author

@khushbr khushbr Oct 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but in this case, the build on the repo depends on coverage verification and will fail now that we are ignoring the redundant NodeStatsFixedShardsMetricsCollectorTests.java.

The coverage increase will have to be separately addressed from this PR.

}
}
}
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why we cannot remove this as part of current release?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the standard practice of marking the class deprecated in (n-1) release and finally removing in nth release.

* 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
Loading