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.")
|
new Description("Bytes of memory retained in JGit block cache.")
|
||||||
.setGauge()
|
.setGauge()
|
||||||
.setUnit(Units.BYTES),
|
.setUnit(Units.BYTES),
|
||||||
WindowCacheStats::getOpenBytes);
|
() -> WindowCacheStats.getStats().getOpenByteCount());
|
||||||
|
|
||||||
metrics.newCallbackMetric(
|
metrics.newCallbackMetric(
|
||||||
"jgit/block_cache/open_files",
|
"jgit/block_cache/open_files",
|
||||||
Integer.class,
|
Long.class,
|
||||||
new Description("File handles held open by JGit block cache.").setGauge().setUnit("fds"),
|
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 mTotal = r.totalMemory();
|
||||||
long mInuse = mTotal - mFree;
|
long mInuse = mTotal - mFree;
|
||||||
|
|
||||||
int jgitOpen = WindowCacheStats.getOpenFiles();
|
long jgitOpen = WindowCacheStats.getStats().getOpenFileCount();
|
||||||
long jgitBytes = WindowCacheStats.getOpenBytes();
|
long jgitBytes = WindowCacheStats.getStats().getOpenByteCount();
|
||||||
|
|
||||||
MemSummaryInfo memSummaryInfo = new MemSummaryInfo();
|
MemSummaryInfo memSummaryInfo = new MemSummaryInfo();
|
||||||
memSummaryInfo.total = bytes(mTotal);
|
memSummaryInfo.total = bytes(mTotal);
|
||||||
@@ -135,7 +135,7 @@ public class GetSummary implements RestReadView<ConfigResource> {
|
|||||||
memSummaryInfo.free = bytes(mFree);
|
memSummaryInfo.free = bytes(mFree);
|
||||||
memSummaryInfo.buffers = bytes(jgitBytes);
|
memSummaryInfo.buffers = bytes(jgitBytes);
|
||||||
memSummaryInfo.max = bytes(mMax);
|
memSummaryInfo.max = bytes(mMax);
|
||||||
memSummaryInfo.openFiles = toInteger(jgitOpen);
|
memSummaryInfo.openFiles = Long.valueOf(jgitOpen);
|
||||||
return memSummaryInfo;
|
return memSummaryInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ public class GetSummary implements RestReadView<ConfigResource> {
|
|||||||
public String free;
|
public String free;
|
||||||
public String buffers;
|
public String buffers;
|
||||||
public String max;
|
public String max;
|
||||||
public Integer openFiles;
|
public Long openFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ThreadSummaryInfo {
|
public static class ThreadSummaryInfo {
|
||||||
|
|||||||
@@ -297,6 +297,10 @@ final class ShowCaches extends SshCommand {
|
|||||||
return i != null ? i : 0;
|
return i != null ? i : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static long nullToZero(Long i) {
|
||||||
|
return i != null ? i : 0;
|
||||||
|
}
|
||||||
|
|
||||||
private void sshSummary() {
|
private void sshSummary() {
|
||||||
IoAcceptor acceptor = daemon.getIoAcceptor();
|
IoAcceptor acceptor = daemon.getIoAcceptor();
|
||||||
if (acceptor == null) {
|
if (acceptor == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user