code: def flush(self):
          
          writer = self.writer
          if writer is None:
              raise GaugedUseAfterFreeError
          self.flush_writer_position()
          keys = self.translate_keys()
          blocks = []
          current_block = self.current_block
          statistics = self.statistics
          driver = self.driver
          flags = 0  # for future extensions, e.g. block compression
          for namespace, key, block in self.pending_blocks():
              length = block.byte_length()
              if not length:
                  continue
              key_id = keys[(namespace, key)]
              statistics[namespace].byte_count += length
              blocks.append((namespace, current_block, key_id, block.buffer(),
                             flags))
          if self.config.overwrite_blocks:
              driver.replace_blocks(blocks)
          else:
              driver.insert_or_append_blocks(blocks)
              if not Gauged.writer_flush_maps(writer, True):
                  raise MemoryError
          update_namespace = driver.add_namespace_statistics
          for namespace, stats in statistics.iteritems():
              update_namespace(namespace, self.current_block,
                               stats.data_points, stats.byte_count)
          statistics.clear()
          driver.commit()
          self.flush_now = False
docs: Flush all pending gauges