private void writeAllMetrics() {
        for (String key : metrics.keySet()) {
            // See: http://docs.appdynamics.com/display/PRO13S/Build+a+Monitoring+Extension+Using+Java#BuildaMonitoringExtensionUsingJava-YourMonitoringExtensionClass
            MetricWriter metricWriter = getMetricWriter(metricPath + key,
                    MetricWriter.METRIC_AGGREGATION_TYPE_OBSERVATION, // Last reported value
                    MetricWriter.METRIC_TIME_ROLLUP_TYPE_AVERAGE, // I changed from Sum to Average.
                    MetricWriter.METRIC_CLUSTER_ROLLUP_TYPE_INDIVIDUAL); // No idea what this is

            // Below line might crash system when deployed
            //System.out.println("PRINTING: " + metricPath + key);
            metricWriter.printMetric(String.valueOf(metrics.get(key)));
        }
    }