Push metrics from nodeagent to containers with timeout - proof of concept
@@ -572,6 +572,15 @@ public class NodeAgentImpl implements NodeAgent {
metricReceiver.declareGauge(MetricReceiverWrapper.APPLICATION_HOST_LIFE, dimensions, "uptime").sample(lastCpuMetric.getUptime());
metricReceiver.declareGauge(MetricReceiverWrapper.APPLICATION_HOST_LIFE, dimensions, "alive").sample(1);
+
+ // Push metrics to the metrics proxy in each container - give it maximum 1 seconds to complete
+ try {
+ //TODO The command here is almost a dummy command until we have the proper RPC method in place
+ // Remember proper argument encoding
+ dockerOperations.executeCommandInContainerAsRoot(containerName, 1L, "sh", "-c", "'echo " + metricReceiver.toString() + "'");
+ } catch (DockerExecTimeoutException e) {
+ logger.warning("Unable to push metrics to container: " + containerName, e);
+ }
}
@SuppressWarnings("unchecked")
