Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Use the correct ctor for NodeDetailsCollector #166

Merged
merged 2 commits into from
Aug 5, 2020
Merged
Changes from 1 commit
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
Next Next commit
Use the correct ctor for NodeDetailsCollector
ktkrg committed Aug 5, 2020

Verified

This commit was signed with the committer’s verified signature.
cosmicBboy Niels Bantilan
commit 36bac9fd4ec55d1d80c34ee8cbfcd064a6836aac
Original file line number Diff line number Diff line change
@@ -188,7 +188,7 @@ public PerformanceAnalyzerPlugin(final Settings settings, final java.nio.file.Pa

scheduledMetricCollectorsExecutor.addScheduledMetricCollector(new MetricsPurgeActivity());

scheduledMetricCollectorsExecutor.addScheduledMetricCollector(new NodeDetailsCollector());

Choose a reason for hiding this comment

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

Can we remove this default constructor from NodeDetailsCollector, or is it required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me check the usages. Maybe the no arg constructor is not used anymore.

scheduledMetricCollectorsExecutor.addScheduledMetricCollector(new NodeDetailsCollector(configOverridesWrapper));
scheduledMetricCollectorsExecutor.addScheduledMetricCollector(new
NodeStatsAllShardsMetricsCollector(performanceAnalyzerController));
scheduledMetricCollectorsExecutor.addScheduledMetricCollector(new
Original file line number Diff line number Diff line change
@@ -68,8 +68,12 @@ public void collectMetrics(long startTime) {
// know this information in advance unless we add the number of nodes as
// additional metadata in the file.
try {
String rcaOverrides = ConfigOverridesHelper.serialize(configOverridesWrapper.getCurrentClusterConfigOverrides());
value.append(rcaOverrides);
if (configOverridesWrapper != null) {
String rcaOverrides = ConfigOverridesHelper.serialize(configOverridesWrapper.getCurrentClusterConfigOverrides());
value.append(rcaOverrides);
} else {
LOG.warn("Overrides wrapper is null. Check NodeDetailsCollector instantiation.");
}
} catch (IOException ioe) {
LOG.error("Unable to serialize rca config overrides.", ioe);
}
Original file line number Diff line number Diff line change
@@ -57,9 +57,13 @@ public ConfigOverridesClusterSettingHandler(final ConfigOverridesWrapper overrid
@Override
public void onSettingUpdate(String newSettingValue) {
try {
final ConfigOverrides newOverrides = ConfigOverridesHelper.deserialize(newSettingValue);
overridesHolder.setCurrentClusterConfigOverrides(newOverrides);
overridesHolder.setLastUpdatedTimestamp(System.currentTimeMillis());
if (newSettingValue != null && !newSettingValue.isEmpty()) {

Choose a reason for hiding this comment

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

Can we add a UT for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will add a UT for this.

final ConfigOverrides newOverrides = ConfigOverridesHelper.deserialize(newSettingValue);
overridesHolder.setCurrentClusterConfigOverrides(newOverrides);
overridesHolder.setLastUpdatedTimestamp(System.currentTimeMillis());
} else {
LOG.warn("Config override setting update called with empty string. Ignoring.");
}
} catch (IOException e) {
LOG.error("Unable to apply received cluster setting update: " + newSettingValue, e);
}
@@ -73,8 +77,7 @@ public void onSettingUpdate(String newSettingValue) {
*/
public void updateConfigOverrides(final ConfigOverrides newOverrides) throws IOException {
String newClusterSettingValue = buildClusterSettingValue(newOverrides);
// TODO: @ktkrg - Change to debug
LOG.error("Updating cluster setting with new overrides string: {}", newClusterSettingValue);
LOG.debug("Updating cluster setting with new overrides string: {}", newClusterSettingValue);
clusterSettingsManager.updateSetting(setting, newClusterSettingValue);
}