Skip to content

Commit

Permalink
Fix master lost file count metric is always 0
Browse files Browse the repository at this point in the history
Cherry-pick of existing commit.
orig-pr: #14401
orig-commit: 5c2f77e
orig-commit-author: Bowen Ding <bowen@alluxio.com>

pr-link: #14415
change-id: cid-eeb1e6c6cbd9821c7f07f9bc6eb58863550e68b7
  • Loading branch information
alluxio-bot committed Nov 4, 2021
1 parent 7690eeb commit 91fb695
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions core/common/src/main/java/alluxio/metrics/MetricKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -348,16 +348,17 @@ public MetricKey build() {
+ "Use this metric to monitor whether your journal is running out of disk space.")
.setMetricType(MetricType.GAUGE)
.build();
public static final MetricKey MASTER_LOST_FILE_COUNT =
new Builder("Master.LostFileCount")
.setDescription("Count of lost files")
.setMetricType(MetricType.GAUGE)
.build();
public static final MetricKey MASTER_LOST_BLOCK_COUNT =
new Builder("Master.LostBlockCount")
.setDescription("Count of lost unique blocks")
.setMetricType(MetricType.GAUGE)
.build();
public static final MetricKey MASTER_LOST_FILE_COUNT =
new Builder("Master.LostFileCount")
.setDescription("Count of lost files. This number is cached and may not be in sync with "
+ String.format("%s", MetricKey.MASTER_LOST_BLOCK_COUNT.getName()))
.setMetricType(MetricType.GAUGE)
.build();
public static final MetricKey MASTER_TOTAL_PATHS =
new Builder("Master.TotalPaths")
.setDescription("Total number of files and directory in Alluxio namespace")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public LostFileDetector(FileSystemMaster fileSystemMaster, InodeTree inodeTree)
mFileSystemMaster = fileSystemMaster;
mInodeTree = inodeTree;
MetricsSystem.registerCachedGaugeIfAbsent(MetricKey.MASTER_LOST_FILE_COUNT.getName(),
mFileSystemMaster.getLostFiles()::size);
() -> mFileSystemMaster.getLostFiles().size());
}

@Override
Expand Down

0 comments on commit 91fb695

Please sign in to comment.