Skip to content

Commit

Permalink
Change severity of negative stats messages from WARN to DEBUG (#60375) (
Browse files Browse the repository at this point in the history
  • Loading branch information
tun0 authored Dec 16, 2021
1 parent e3f725f commit acd1941
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public long getFreePhysicalMemorySize() {
try {
final long freeMem = (long) getFreePhysicalMemorySize.invoke(osMxBean);
if (freeMem < 0) {
logger.warn("OS reported a negative free memory value [{}]", freeMem);
logger.debug("OS reported a negative free memory value [{}]", freeMem);
return 0;
}
return freeMem;
Expand All @@ -113,7 +113,7 @@ public long getTotalPhysicalMemorySize() {
try {
final long totalMem = (long) getTotalPhysicalMemorySize.invoke(osMxBean);
if (totalMem < 0) {
logger.warn("OS reported a negative total memory value [{}]", totalMem);
logger.debug("OS reported a negative total memory value [{}]", totalMem);
return 0;
}
return totalMem;
Expand All @@ -134,7 +134,7 @@ public long getFreeSwapSpaceSize() {
try {
final long mem = (long) getFreeSwapSpaceSize.invoke(osMxBean);
if (mem < 0) {
logger.warn("OS reported a negative free swap space size [{}]", mem);
logger.debug("OS reported a negative free swap space size [{}]", mem);
return 0;
}
return mem;
Expand All @@ -155,7 +155,7 @@ public long getTotalSwapSpaceSize() {
try {
final long mem = (long) getTotalSwapSpaceSize.invoke(osMxBean);
if (mem < 0) {
logger.warn("OS reported a negative total swap space size [{}]", mem);
logger.debug("OS reported a negative total swap space size [{}]", mem);
return 0;
}
return mem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ public ByteSizeValue getUsed() {
//
// We intentionally check for (total == 0) rather than (total - free < 0) so as not to hide
// cases where (free > total) which would be a different bug.
logger.warn("cannot compute used swap when total swap is 0 and free swap is " + free);
if (free > 0) {
logger.debug("cannot compute used swap when total swap is 0 and free swap is " + free);
}
return new ByteSizeValue(0);
}
return new ByteSizeValue(total - free);
Expand Down Expand Up @@ -304,7 +306,9 @@ public ByteSizeValue getUsed() {
//
// We intentionally check for (total == 0) rather than (total - free < 0) so as not to hide
// cases where (free > total) which would be a different bug.
logger.warn("cannot compute used memory when total memory is 0 and free memory is " + free);
if (free > 0) {
logger.debug("cannot compute used memory when total memory is 0 and free memory is " + free);
}
return new ByteSizeValue(0);
}
return new ByteSizeValue(total - free);
Expand Down

0 comments on commit acd1941

Please sign in to comment.