You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling getContainerStats(String containerId), the Statistics object returned is null, even though the logs show a value. Specifically, when calling cpuUsage.getTotalUsage(), the function returns null, but the log output suggests that a value is present.
Code Sample
Here is the code used to retrieve container stats:
publicStatisticsgetContainerStats(StringcontainerId) {
InvocationBuilder.AsyncResultCallback<Statistics> callback = newInvocationBuilder.AsyncResultCallback<>();
dockerClient.statsCmd(containerId).exec(callback);
Statisticsstats;
try {
stats = callback.awaitResult();
callback.close();
} catch (IOExceptione) {
log.error("Failed to get container stats: {}", containerId, e);
thrownewRuntimeException("Failed to get container stats", e);
}
returnstats;
}
Description
When calling
getContainerStats(String containerId)
, theStatistics
object returned isnull
, even though the logs show a value. Specifically, when callingcpuUsage.getTotalUsage()
, the function returnsnull
, but the log output suggests that a value is present.Code Sample
Here is the code used to retrieve container stats:
To fetch CPU usage:
Observed Behavior
cpuUsage.getTotalUsage()
method always returnsnull
.log.info("Total CPU usage: {}", cpuUsage.getTotalUsage());
correctly displays a value.Expected Behavior
cpuUsage.getTotalUsage()
should return the same value as seen in the logs.The text was updated successfully, but these errors were encountered: