Skip to content

Commit ee3dc25

Browse files
Merge branch 'ac-pr-final-1' of github.com:bharath-techie/OpenSearch into ac-pr-fs-stats-1
2 parents bf75f28 + f867acf commit ee3dc25

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

server/src/main/java/org/opensearch/monitor/fs/FsHealthService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public class FsHealthService extends AbstractLifecycleComponent implements NodeH
9696
);
9797
public static final Setting<TimeValue> REFRESH_INTERVAL_SETTING = Setting.timeSetting(
9898
"monitor.fs.health.refresh_interval",
99-
TimeValue.timeValueSeconds(60),
99+
TimeValue.timeValueSeconds(1),
100100
TimeValue.timeValueMillis(1),
101101
Setting.Property.NodeScope
102102
);
@@ -228,6 +228,7 @@ private void monitorFSHealth() {
228228
}
229229
Files.delete(tempDataPath);
230230
final long elapsedTime = currentTimeMillisSupplier.getAsLong() - executionStartTime;
231+
logger.info("health check took {}", elapsedTime);
231232
if (elapsedTime > slowPathLoggingThreshold.millis()) {
232233
logger.warn(
233234
"health check of [{}] took [{}ms] which is above the warn threshold of [{}]",

server/src/main/java/org/opensearch/throttling/tracker/AverageIOUsageTracker.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ private void recordUsage(IoUsageFetcher.DiskStats usage) {
145145
protected void doStart() {
146146
scheduledFuture = threadPool.scheduleWithFixedDelay(() -> {
147147
IoUsageFetcher.DiskStats usage = getUsage();
148+
if(usage == null) return;
148149
recordUsage(usage);
149150
}, pollingInterval, ThreadPool.Names.GENERIC);
150151
}

server/src/main/java/org/opensearch/throttling/tracker/IoUsageFetcher.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,12 @@ public DiskStats getDiskUtilizationStats() {
8181
double writeLatency = 0.0;
8282
double readOps = 0.0;
8383
double writeOps = 0.0;
84+
if(this.fsService.stats().getIoStats() == null) {
85+
return null;
86+
}
8487
for (FsInfo.DeviceStats devicesStat : this.fsService.stats().getIoStats().getDevicesStats()) {
8588
if (previousIOTimeMap != null && previousIOTimeMap.containsKey(devicesStat.getDeviceName())){
86-
logger.info(this.fsService.stats().getTimestamp());
89+
//logger.info(this.fsService.stats().getTimestamp());
8790
long ioSpentTime = devicesStat.getCurrentIOTime() - previousIOTimeMap.get(devicesStat.getDeviceName()).ioTime;
8891
ioUsePercent = (ioSpentTime * 100) / (1000);
8992
readOps += devicesStat.currentReadOperations() - previousIOTimeMap.get(devicesStat.getDeviceName()).readOps;
@@ -104,11 +107,11 @@ public DiskStats getDiskUtilizationStats() {
104107
devicesStat.getCurrentReadKilobytes(), devicesStat.getCurrentWriteKilobytes());
105108
currentIOTimeMap.put(devicesStat.getDeviceName(), ps);
106109
}
107-
logger.info("Read in MB : {} , Write in MB : {}", readkb/1000, writekb/1000);
110+
// logger.info("Read in MB : {} , Write in MB : {}", readkb/1000, writekb/1000);
108111
// readLatency += (readOps / readTime) * 100;
109112
// writeLatency += (writeOps / writeTime) * 100;
110-
logger.info("read ops : {} , writeops : {} , readtime: {} , writetime: {}", readOps, writeOps, readTime, writeTime);
111-
logger.info("Read latency : {} write latency : {}" , readLatency, writeLatency);
113+
// logger.info("read ops : {} , writeops : {} , readtime: {} , writetime: {}", readOps, writeOps, readTime, writeTime);
114+
// logger.info("Read latency : {} write latency : {}" , readLatency, writeLatency);
112115
logger.info("IO use percent : {}", ioUsePercent);
113116
previousIOTimeMap = currentIOTimeMap;
114117

server/src/main/java/org/opensearch/throttling/tracker/PerformanceTrackerSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private static class Defaults {
2323
private static final long WINDOW_DURATION = 30;
2424
private static final long REFRESH_INTERVAL = 1000;
2525

26-
private static final long IO_POLLING_INTERVAL = 60000;
26+
private static final long IO_POLLING_INTERVAL = 1000;
2727
private static final long IO_WINDOW_DURATION = 60;
2828
}
2929

0 commit comments

Comments
 (0)