1. Aug 11th, 2010

    Vanity 1.4: Connection adapters

    Vanity 1.4 introduces a lot of new features specifically around metrics and data storage.

    Connection Adapters

    First, connection adapters. Not just for Redis. Well, right now there are only two of them, one for Redis and one for MongoDB, but adding another database adapter is no longer a painful exercise.

    In fact, here’s your chance to help. Adopt An Adapter. Either write one from scratch, or take ownership of existing adapter and make it better/faster and help maintain it in future releases.

    Version 1.4 also introduces new configuration file, config/vanity.yml, easy way to configure adapters for different environments. For example:

    production:
      adapter: mongodb
    development:
      adapter: redis

    But you probably don’t need to configure test environment, see Playground.collecting below.

    Upgrade Your Data

    Rolled in there is a switch to the newer Redis library, and some cleanup to the way data is stored, which makes Vanity 1.4 incompatible with 1.3.

    If you want to access the metric and experiment data, you need to tell Vanity to upgrade the database’s contents:

    $ vanity upgrade

    Mock is Dead, Long Live Playground.collecting

    Vanity 1.3 actually had two adapters, Redis and Mock. The Mock adapter is still there in 1.4, but I’m thinking of deprecating it in favor of a different strategy.

    Vanity 1.4 can run in two modes. When collection is turned on, it stores metrics, experiments and other state information in the database. That’s the mode you want to use in production, maybe also in development.

    When collection is turned off, no data gets stored in the database. Some features that do need to hold state (e.g for testing different A/B paths), will hold on to it in memory, but will lose it when the playground is discarded (during test teardown). This is the mode you want to use when running unit and functional tests.

    Under Rails, collection is turned off in all environments except production. If your development environment has more than one process you may need to turn collection on in development as well. It’s as simple as:

    Vanity.playground.collecting = true

    Experimental

    New page that covers work-in-progress features and ideas for future releases. Check it out if you want to know what the future holds, or just interested in picking a cool feature to contribute to.

    Your comment, here ⇓