- A
Rack::Middlewarethat sends selected parts of the request environment to an UDP socket - An
EventMachinedaemon that opens an UDP socket and sends out received data to CouchDB - A set of CouchDB map-reduce views, for analysis
Yes, but the release is still incomplete, because currently tests are too tied to Panmind logic.
If you can help in complete the test suite, it is much appreciated :-).
-
Add the usage_tracker gem to your Gemfile and require the middleware
gem 'usage_tracker', :require => 'usage_tracker/middleware'
-
Add the Middleware to your application:
Your::Application.config.middleware.use UsageTracker::Middleware
-
The daemon can be started manually with the following command, inside a Rails.root:
$ usage_tracker [environment]
environmentis optional and will default to "development" if no command line option nor the RAILS_ENV environment variable are set.or can be put under Upstart using the provided configuration file located in
config/usage_tracker_upstart.conf. Check it out and modify it to suit your needs.The daemon logs to
log/usage_tracker.logand rotates its logs when receives the USR1 signal. -
The daemon writes its pid into tmp/pids/usage_tracker.pid
-
The daemon connects to a Couch database named
usage_trackerrunning onlocalhost, default port5984/TCP, and listens onlocalhost, port5985/UDPby default. You can change these settings via aconfig/usage_tracker.ymlfile. See the example in theconfigdirectory of the gem distribution. -
The CouchDB instance must be running, the database is created (and updated) if necessary.
-
If the daemon cannot start, e.g. because of unavailable database or listening address, it will print a diagnostig message to STDERR, log to usage_tracker.log and exit with status of 1.
-
The daemon exits gracefully if it receives the INT or the TERM signals.
The current test suite, brutally extracted from Panmind codebase, is in the
middleware_test.rb file at the root of the Gem distribution. It is of no
use except Panmind, but it's a start for writing new ones. Please help! :-)