code: protected void regenerateMetrics() {
      if (isInstrumentationEnabled()) {
        this.recordsInMeter = Optional.of(this.metricContext.meter(MetricNames.DataWriterMetrics.RECORDS_IN_METER));
        this.successfulWritesMeter =
            Optional.of(this.metricContext.meter(MetricNames.DataWriterMetrics.SUCCESSFUL_WRITES_METER));
        this.failedWritesMeter = Optional.of(this.metricContext.meter(MetricNames.DataWriterMetrics.FAILED_WRITES_METER));
        setRecordsWrittenMeter(isInstrumentationEnabled());
        setBytesWrittenMeter(isInstrumentationEnabled());
        this.dataWriterTimer = Optional.<Timer>of(this.metricContext.timer(MetricNames.DataWriterMetrics.WRITE_TIMER));
      } else {
        this.recordsInMeter = Optional.absent();
        this.successfulWritesMeter = Optional.absent();
        this.failedWritesMeter = Optional.absent();
        setRecordsWrittenMeter(isInstrumentationEnabled());
        setBytesWrittenMeter(isInstrumentationEnabled());
        this.dataWriterTimer = Optional.absent();
      }
    }
docs: Generates metrics for the instrumentation of this class.