microsoft-azure-storage/src/com/microsoft/azure/storage/ServicePropertiesSerializer.java
private static void writeMetricsProperties(final XmlSerializer xmlw, final MetricsProperties metrics,
            final String metricsName) throws IllegalArgumentException, IllegalStateException, IOException {
        Utility.assertNotNull("metrics.Configuration", metrics.getMetricsLevel());

        // Metrics
        xmlw.startTag(Constants.EMPTY_STRING, metricsName);

        // Version
        Utility.serializeElement(xmlw, Constants.AnalyticsConstants.VERSION_ELEMENT, metrics.getVersion());

        // Enabled
        Utility.serializeElement(xmlw, Constants.AnalyticsConstants.ENABLED_ELEMENT,
                metrics.getMetricsLevel() != MetricsLevel.DISABLED ? Constants.TRUE : Constants.FALSE);

        if (metrics.getMetricsLevel() != MetricsLevel.DISABLED) {
            // Include APIs
            Utility.serializeElement(xmlw, Constants.AnalyticsConstants.INCLUDE_APIS_ELEMENT,
                    metrics.getMetricsLevel() == MetricsLevel.SERVICE_AND_API ? Constants.TRUE : Constants.FALSE);
        }

        // Retention Policy
        writeRetentionPolicy(xmlw, metrics.getRetentionIntervalInDays());

        // end Metrics
        xmlw.endTag(Constants.EMPTY_STRING, metricsName);
    }
private static void writeMetricsProperties(final XmlSerializer xmlw, final MetricsProperties metrics,
            final String metricsName) throws IllegalArgumentException, IllegalStateException, IOException {
        Utility.assertNotNull("metrics.Configuration", metrics.getMetricsLevel());

        // Metrics
        xmlw.startTag(Constants.EMPTY_STRING, metricsName);

        // Version
        Utility.serializeElement(xmlw, Constants.AnalyticsConstants.VERSION_ELEMENT, metrics.getVersion());

        // Enabled
        Utility.serializeElement(xmlw, Constants.AnalyticsConstants.ENABLED_ELEMENT,
                metrics.getMetricsLevel() != MetricsLevel.DISABLED ? Constants.TRUE : Constants.FALSE);

        if (metrics.getMetricsLevel() != MetricsLevel.DISABLED) {
            // Include APIs
            Utility.serializeElement(xmlw, Constants.AnalyticsConstants.INCLUDE_APIS_ELEMENT,
                    metrics.getMetricsLevel() == MetricsLevel.SERVICE_AND_API ? Constants.TRUE : Constants.FALSE);
        }

        // Retention Policy
        writeRetentionPolicy(xmlw, metrics.getRetentionIntervalInDays());

        // end Metrics
        xmlw.endTag(Constants.EMPTY_STRING, metricsName);
    }
Writes the given metrics properties to the XMLStreamWriter.

@param xmlw
the XMLStreamWriter to write to.
@param metrics
the metrics properties to be written.
@param metricsName
the type of metrics properties to be written (Hour or Minute)
@throws IOException
if there is an error writing the service properties.
@throws IllegalStateException
if there is an error writing the service properties.
@throws IllegalArgumentException
if there is an error writing the service properties.