Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: Atharva Sharma <[email protected]>
  • Loading branch information
atharvasharma61 committed Jun 3, 2024
1 parent 369bd95 commit 25d66e8
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,32 @@
import org.opensearch.env.NodeEnvironment;
import org.opensearch.index.IndexModule;
import org.opensearch.performanceanalyzer.action.PerformanceAnalyzerActionFilter;
import org.opensearch.performanceanalyzer.collectors.*;
import org.opensearch.performanceanalyzer.collectors.AdmissionControlMetricsCollector;
import org.opensearch.performanceanalyzer.collectors.CacheConfigMetricsCollector;
import org.opensearch.performanceanalyzer.collectors.CircuitBreakerCollector;
import org.opensearch.performanceanalyzer.collectors.ClusterApplierServiceStatsCollector;
import org.opensearch.performanceanalyzer.collectors.ClusterManagerServiceEventMetrics;
import org.opensearch.performanceanalyzer.collectors.ClusterManagerServiceMetrics;
import org.opensearch.performanceanalyzer.collectors.ElectionTermCollector;
import org.opensearch.performanceanalyzer.collectors.FaultDetectionMetricsCollector;
import org.opensearch.performanceanalyzer.collectors.NodeDetailsCollector;
import org.opensearch.performanceanalyzer.collectors.NodeStatsAllShardsMetricsCollector;
import org.opensearch.performanceanalyzer.collectors.SearchBackPressureStatsCollector;
import org.opensearch.performanceanalyzer.collectors.ShardIndexingPressureMetricsCollector;
import org.opensearch.performanceanalyzer.collectors.ShardStateCollector;
import org.opensearch.performanceanalyzer.collectors.ThreadPoolMetricsCollector;
import org.opensearch.performanceanalyzer.collectors.telemetry.RTFDisksCollector;
import org.opensearch.performanceanalyzer.collectors.telemetry.RTFHeapMetricsCollector;
import org.opensearch.performanceanalyzer.collectors.telemetry.RTFNodeStatsAllShardsMetricsCollector;
import org.opensearch.performanceanalyzer.collectors.telemetry.RTFThreadPoolMetricsCollector;
import org.opensearch.performanceanalyzer.commons.OSMetricsGeneratorFactory;
import org.opensearch.performanceanalyzer.commons.collectors.*;
import org.opensearch.performanceanalyzer.commons.collectors.DisksCollector;
import org.opensearch.performanceanalyzer.commons.collectors.GCInfoCollector;
import org.opensearch.performanceanalyzer.commons.collectors.HeapMetricsCollector;
import org.opensearch.performanceanalyzer.commons.collectors.NetworkInterfaceCollector;
import org.opensearch.performanceanalyzer.commons.collectors.OSMetricsCollector;
import org.opensearch.performanceanalyzer.commons.collectors.ScheduledMetricCollectorsExecutor;
import org.opensearch.performanceanalyzer.commons.collectors.StatsCollector;
import org.opensearch.performanceanalyzer.commons.config.PluginSettings;
import org.opensearch.performanceanalyzer.commons.config.overrides.ConfigOverridesWrapper;
import org.opensearch.performanceanalyzer.commons.event_process.EventLog;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ configOverridesWrapper, getCollectorName())) {
public void recordMetrics(DiskMetricsGenerator diskMetricsGenerator) {
for (String disk : diskMetricsGenerator.getAllDisks()) {
Tags diskNameTag = Tags.create().addTag("disk_name", disk);
double Disk_WaitTime = diskMetricsGenerator.getAwait(disk);
double Disk_ServiceRate = diskMetricsGenerator.getServiceRate(disk);
double Disk_Utilization = diskMetricsGenerator.getDiskUtilization(disk);
diskWaitTimeMetrics.record(Disk_WaitTime, diskNameTag);
diskUtilizationMetrics.record(Disk_Utilization, diskNameTag);
diskServiceRateMetrics.record(Disk_ServiceRate, diskNameTag);
double diskWaitTime = diskMetricsGenerator.getAwait(disk);
double diskServiceRate = diskMetricsGenerator.getServiceRate(disk);
double diskUtilization = diskMetricsGenerator.getDiskUtilization(disk);
diskWaitTimeMetrics.record(diskWaitTime, diskNameTag);
diskUtilizationMetrics.record(diskUtilization, diskNameTag);
diskServiceRateMetrics.record(diskServiceRate, diskNameTag);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public enum PerformanceAnalyzerFeatureBits {
Setting.Property.NodeScope,
Setting.Property.Dynamic);

/** Cluster setting controlling TELEMETRY/RCA/BOTH/NONE collectors enabled. */
public static final Setting<Integer> PA_COLLECTORS_SETTING =
Setting.intSetting(
"cluster.metadata.perf_analyzer.collectors.enabled",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ public void updateCollectorsSetting(final int value) {
PerformanceAnalyzerClusterSettings.PA_COLLECTORS_SETTING, value);
}

/**
* Handler that gets called when there is a new value for the setting that this listener is
* listening to.
*
* @param newSettingValue The value of the new setting.
*/
@Override
public void onSettingUpdate(final Integer newSettingValue) {
if (newSettingValue != null) {
Expand Down

0 comments on commit 25d66e8

Please sign in to comment.