code: public void updateMetricsRecord() {
      for (Map.Entry<MetricName, Long> entry: counters.entrySet()) {
        String name = (entry.getKey() + "_" + type).toLowerCase();
        record.setMetric(name, entry.getValue());
      }
      record.update();
    }
docs: Update the metrics record associated with this object.