Search in sources :

Example 1 with MetricStringBuilder

use of org.apache.hadoop.metrics2.MetricStringBuilder in project hadoop by apache.

the class S3AInstrumentation method dump.

/**
   * Dump all the metrics to a string.
   * @param prefix prefix before every entry
   * @param separator separator between name and value
   * @param suffix suffix
   * @param all get all the metrics even if the values are not changed.
   * @return a string dump of the metrics
   */
public String dump(String prefix, String separator, String suffix, boolean all) {
    MetricStringBuilder metricBuilder = new MetricStringBuilder(null, prefix, separator, suffix);
    registry.snapshot(metricBuilder, all);
    for (Map.Entry<String, MutableCounterLong> entry : streamMetrics.entrySet()) {
        metricBuilder.tuple(entry.getKey(), Long.toString(entry.getValue().value()));
    }
    return metricBuilder.toString();
}
Also used : MetricStringBuilder(org.apache.hadoop.metrics2.MetricStringBuilder) MutableCounterLong(org.apache.hadoop.metrics2.lib.MutableCounterLong) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 MetricStringBuilder (org.apache.hadoop.metrics2.MetricStringBuilder)1 MutableCounterLong (org.apache.hadoop.metrics2.lib.MutableCounterLong)1