@Override
public MetricsRecord emit(long timestamp) {
ImmutableList.Builder<TagMetric> builder = ImmutableList.builder();
int value = this.value.getAndSet(0);
for (Map.Entry<String, AtomicInteger> entry : tagValues.asMap().entrySet()) {
builder.add(new TagMetric(entry.getKey(), entry.getValue().getAndSet(0)));
}
return new MetricsRecord(context, runId, name, builder.build(), timestamp, value);
}