def flush_gauges(gauges)
      return if gauges.empty?

      to_flush = gauges.dup
      @buf[:gauges] = empty_gauges

      writer.write(gauges_to_wf(gauges)).tap do |resp|
        @buf[:gauges] += to_flush unless resp.ok?
      end
    end
def flush_gauges(gauges)
      return if gauges.empty?

      to_flush = gauges.dup
      @buf[:gauges] = empty_gauges

      writer.write(gauges_to_wf(gauges)).tap do |resp|
        @buf[:gauges] += to_flush unless resp.ok?
      end
    end
When we are asked to flush the buffers, duplicate the current
 one, hand it off to the writer class, and clear. If writer
 tells us there was an error, dump the old buffer into the
 the new one for the next flush.