Refactor for test-, mock-ability
Add ability to publish measurements via Redis pub/sub

When REDIS_PUBLISH is set to something other than `no`, publish
measurement with Redis PUBLISH command.  This allows other tools to
consume the measurements in real time.
Add comments