Adapt to deprecation of WindowCacheStats methods in JGit
Commit 42f0c7c9c ("Enhance WindowCache statistics") [1] deprecated
the getOpenFiles() and getOpenByteCount() methods.
Also adjust to the number of open files now being long instead
of integer.
[1] https://git.eclipse.org/r/#/c/153601/
Change-Id: I9f7ebb11ddf541a6601406d713f7e90065804e48
This commit is contained in:
@@ -28,12 +28,12 @@ public class JGitMetricModule extends MetricModule {
|
||||
new Description("Bytes of memory retained in JGit block cache.")
|
||||
.setGauge()
|
||||
.setUnit(Units.BYTES),
|
||||
WindowCacheStats::getOpenBytes);
|
||||
() -> WindowCacheStats.getStats().getOpenByteCount());
|
||||
|
||||
metrics.newCallbackMetric(
|
||||
"jgit/block_cache/open_files",
|
||||
Integer.class,
|
||||
Long.class,
|
||||
new Description("File handles held open by JGit block cache.").setGauge().setUnit("fds"),
|
||||
WindowCacheStats::getOpenFiles);
|
||||
() -> WindowCacheStats.getStats().getOpenFileCount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,8 +126,8 @@ public class GetSummary implements RestReadView<ConfigResource> {
|
||||
long mTotal = r.totalMemory();
|
||||
long mInuse = mTotal - mFree;
|
||||
|
||||
int jgitOpen = WindowCacheStats.getOpenFiles();
|
||||
long jgitBytes = WindowCacheStats.getOpenBytes();
|
||||
long jgitOpen = WindowCacheStats.getStats().getOpenFileCount();
|
||||
long jgitBytes = WindowCacheStats.getStats().getOpenByteCount();
|
||||
|
||||
MemSummaryInfo memSummaryInfo = new MemSummaryInfo();
|
||||
memSummaryInfo.total = bytes(mTotal);
|
||||
@@ -135,7 +135,7 @@ public class GetSummary implements RestReadView<ConfigResource> {
|
||||
memSummaryInfo.free = bytes(mFree);
|
||||
memSummaryInfo.buffers = bytes(jgitBytes);
|
||||
memSummaryInfo.max = bytes(mMax);
|
||||
memSummaryInfo.openFiles = toInteger(jgitOpen);
|
||||
memSummaryInfo.openFiles = Long.valueOf(jgitOpen);
|
||||
return memSummaryInfo;
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ public class GetSummary implements RestReadView<ConfigResource> {
|
||||
public String free;
|
||||
public String buffers;
|
||||
public String max;
|
||||
public Integer openFiles;
|
||||
public Long openFiles;
|
||||
}
|
||||
|
||||
public static class ThreadSummaryInfo {
|
||||
|
||||
@@ -297,6 +297,10 @@ final class ShowCaches extends SshCommand {
|
||||
return i != null ? i : 0;
|
||||
}
|
||||
|
||||
private static long nullToZero(Long i) {
|
||||
return i != null ? i : 0;
|
||||
}
|
||||
|
||||
private void sshSummary() {
|
||||
IoAcceptor acceptor = daemon.getIoAcceptor();
|
||||
if (acceptor == null) {
|
||||
|
||||
Reference in New Issue
Block a user