Skip to content

Commit

Permalink
Merge branch 'ac-pr-final-1' of github.com:bharath-techie/OpenSearch …
Browse files Browse the repository at this point in the history
…into ac-pr-fs-stats-1
  • Loading branch information
bharath-techie committed Sep 20, 2023
2 parents bf75f28 + f867acf commit ee3dc25
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public class FsHealthService extends AbstractLifecycleComponent implements NodeH
);
public static final Setting<TimeValue> REFRESH_INTERVAL_SETTING = Setting.timeSetting(
"monitor.fs.health.refresh_interval",
TimeValue.timeValueSeconds(60),
TimeValue.timeValueSeconds(1),
TimeValue.timeValueMillis(1),
Setting.Property.NodeScope
);
Expand Down Expand Up @@ -228,6 +228,7 @@ private void monitorFSHealth() {
}
Files.delete(tempDataPath);
final long elapsedTime = currentTimeMillisSupplier.getAsLong() - executionStartTime;
logger.info("health check took {}", elapsedTime);
if (elapsedTime > slowPathLoggingThreshold.millis()) {
logger.warn(
"health check of [{}] took [{}ms] which is above the warn threshold of [{}]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ private void recordUsage(IoUsageFetcher.DiskStats usage) {
protected void doStart() {
scheduledFuture = threadPool.scheduleWithFixedDelay(() -> {
IoUsageFetcher.DiskStats usage = getUsage();
if(usage == null) return;
recordUsage(usage);
}, pollingInterval, ThreadPool.Names.GENERIC);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,12 @@ public DiskStats getDiskUtilizationStats() {
double writeLatency = 0.0;
double readOps = 0.0;
double writeOps = 0.0;
if(this.fsService.stats().getIoStats() == null) {
return null;
}
for (FsInfo.DeviceStats devicesStat : this.fsService.stats().getIoStats().getDevicesStats()) {
if (previousIOTimeMap != null && previousIOTimeMap.containsKey(devicesStat.getDeviceName())){
logger.info(this.fsService.stats().getTimestamp());
//logger.info(this.fsService.stats().getTimestamp());
long ioSpentTime = devicesStat.getCurrentIOTime() - previousIOTimeMap.get(devicesStat.getDeviceName()).ioTime;
ioUsePercent = (ioSpentTime * 100) / (1000);
readOps += devicesStat.currentReadOperations() - previousIOTimeMap.get(devicesStat.getDeviceName()).readOps;
Expand All @@ -104,11 +107,11 @@ public DiskStats getDiskUtilizationStats() {
devicesStat.getCurrentReadKilobytes(), devicesStat.getCurrentWriteKilobytes());
currentIOTimeMap.put(devicesStat.getDeviceName(), ps);
}
logger.info("Read in MB : {} , Write in MB : {}", readkb/1000, writekb/1000);
// logger.info("Read in MB : {} , Write in MB : {}", readkb/1000, writekb/1000);
// readLatency += (readOps / readTime) * 100;
// writeLatency += (writeOps / writeTime) * 100;
logger.info("read ops : {} , writeops : {} , readtime: {} , writetime: {}", readOps, writeOps, readTime, writeTime);
logger.info("Read latency : {} write latency : {}" , readLatency, writeLatency);
// logger.info("read ops : {} , writeops : {} , readtime: {} , writetime: {}", readOps, writeOps, readTime, writeTime);
// logger.info("Read latency : {} write latency : {}" , readLatency, writeLatency);
logger.info("IO use percent : {}", ioUsePercent);
previousIOTimeMap = currentIOTimeMap;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ private static class Defaults {
private static final long WINDOW_DURATION = 30;
private static final long REFRESH_INTERVAL = 1000;

private static final long IO_POLLING_INTERVAL = 60000;
private static final long IO_POLLING_INTERVAL = 1000;
private static final long IO_WINDOW_DURATION = 60;
}

Expand Down

0 comments on commit ee3dc25

Please sign in to comment.