You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2018/01/05 21:25:39 UTC
[GitHub] pasha-kuznetsov opened a new issue #954: dir_*_usage stats are always 0
pasha-kuznetsov opened a new issue #954: dir_*_usage stats are always 0
URL: https://github.com/apache/bookkeeper/issues/954
**BUG REPORT**
1. Please describe the issue you observed:
- What did you do?
Normal BK operation
- What did you expect to see?
`dir_*_usage` gauges to contain dir usage %
- What did you see instead?
`dir_*_usage` gauges are always `0` due to mismatch between the way they are initialized in `LedgerDirsManager`:
```
LedgerDirsManager(ServerConfiguration conf, File[] dirs, DiskChecker diskChecker, StatsLogger statsLogger) {
this.ledgerDirectories = Arrays.asList(Bookie
.getCurrentDirectories(dirs)); // <------------- NOTE adding "/current" here
this.writableLedgerDirectories = new ArrayList<File>(ledgerDirectories);
this.filledDirs = new ArrayList<File>();
...
for (File dir : dirs) { // <------------- NOTE using the original dirs
diskUsages.put(dir, 0f);
String statName = "dir_" + dir.getPath().replace('/', '_') + "_usage";
final File targetDir = dir;
statsLogger.registerGauge(statName, new Gauge<Number>() {
...
@Override
public Number getSample() {
return diskUsages.get(targetDir) * 100;
}
});
}
```
and the way the `diskUsages` is populated subsequently in `LedgerDirsMonitor`:
```
@Override
public void run() {
while (true) {
try {
List<File> writableDirs = ldm.getWritableLedgerDirs();
// Check all writable dirs disk space usage.
for (File dir : writableDirs) {
try {
diskUsages.put(dir, diskChecker.checkDir(dir)); // <------------- NOTE that writableDirs has "/current" appended
...
try {
if (hasWritableLedgerDirs
|| (totalDiskUsage = diskChecker.getTotalDiskUsage(ldm.getAllLedgerDirs())) < conf
.getDiskLowWaterMarkUsageThreshold()) {
// Check all full-filled disk space usage
for (File dir : fullfilledDirs) {
try {
diskUsages.put(dir, diskChecker.checkDir(dir)); // <------------- NOTE that fullfilledDirs has "/current" appended
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services