Skip logging of GCStatusMonitor state if there is no activity
Don't print headers when there are no active queries/tasks to avoid
polluting log files.
@@ -173,6 +173,7 @@ public class GcStatusMonitor
Long.toString(userMemoryReservation),
Long.toString(systemMemoryReservation));
}).collect(toImmutableList());
+ if (!rows.isEmpty()) {
logInfoTable(ImmutableList.<List<String>>builder().add(
ImmutableList.of(
"Query ID",
@@ -182,6 +183,7 @@ public class GcStatusMonitor
.addAll(rows)
.build());
}
+ }
private static void logTaskStats(List<QueryId> queryIds, ListMultimap<QueryId, SqlTask> tasksByQueryId)
{
@@ -213,7 +215,7 @@ public class GcStatusMonitor
Long.toString(taskIOStats.getOutputPositions().getTotalCount()));
});
}).collect(toImmutableList());
-
+ if (!rows.isEmpty()) {
logInfoTable(ImmutableList.<List<String>>builder()
.add(ImmutableList.of(
"Query ID",
@@ -229,6 +231,7 @@ public class GcStatusMonitor
.addAll(rows)
.build());
}
+ }
private static void logInfoTable(List<List<String>> table)
{
