Agent's child process GC collector not reporting stats sometimes. When agent launches a child process it also starts a GC collector which probes the remote MBeanServer for current garbage collector stats. The remote process sends an update to the agent which includes process JMX port. This port is used by the GC collector to connect to the remote. There is a race here: an agent can start GC collector before it receives JMX port from the remote. The current code establishes JMX connection in its constructor which is a bug. If it fails to connect, it silently goes on and keeps reporting 0 for GC stats.
The fix is to improve logging to clearly identify what is happening. Since the collector is called on a timer, it should always check its connection and try to establish it if a previous attempt failed.