try {
context.setTime(System.currentTimeMillis());
for (Entry<String, SortedMap<MetricName, Metric>> entry : getMetricsRegistry().groupedMetrics().entrySet()) {
for (Entry<MetricName, Metric> subEntry : entry.getValue().entrySet()) {
MetricName name = subEntry.getKey();
Metric metric = subEntry.getValue();
if (metric instanceof Counter) {
context.typeTable.put(name, "counter");
} else if (metric instanceof Gauge) {
context.typeTable.put(name, "gauge");
} else if (metric instanceof Histogram) {
context.typeTable.put(name, "histogram");
} else if (metric instanceof Meter) {
context.typeTable.put(name, "meter");
} else if (metric instanceof Timer) {
context.typeTable.put(name, "timer");
}
metric.processWith(this, name, context);
}
}
ResetableCharArrayWriter writer = getWriter();
writer.reset();
Set<Entry<MetricName, MetricInfo>> entrySet = context.metricInfoMap.entrySet();