code: @Override
    public void writeEnvelope(RecordEnvelope<D> record) throws IOException {
      try {
        if (ThrottleType.QPS.equals(type)) {
          acquirePermits(1L);
        }
        long beforeWrittenBytes = writer.bytesWritten();
        writer.writeEnvelope(record);
  
        if (ThrottleType.Bytes.equals(type)) {
          long delta = writer.bytesWritten() - beforeWrittenBytes;
          if (delta < 0) {
            throw new UnsupportedOperationException("Cannot throttle on bytes because "
                                                    + writer.getClass().getSimpleName() + " does not supports bytesWritten");
          }
  
          if (delta > 0) {
            acquirePermits(delta);
          }
        }
      } catch (InterruptedException e) {
        throw new IOException("Failed while acquiring permits.",e);
      }
    }
docs: Calls inner writer with self throttling.
  If the throttle type is byte, it applies throttle after write happens.
  This is because it can figure out written bytes after it's written. It's not ideal but throttling after write should be sufficient for most cases.
  {@inheritDoc}
  @see org.apache.gobblin.writer.DataWriter#write(java.lang.Object)