Metrics is a tool for tracking arbitrary metrics via Slack.
At Collective Idea, we love data! We also use Slack for a lot of our day-to-day communications. The Metrics app allows us to track all sorts of data without leaving our normal workflow.
We use Slack's Slash Commands to listen
to our team for /track
commands. When one is found, it's sent to the Metrics
app to be parsed. The app stores several metrics with regular expression
patterns that may or may not match the incoming command.
If a matching metric is found, the command text is parsed, capturing data from all named groups as metadata. A data point is created for that metric, for that user, with that metadata.
The data point stores its metadata in hstore. The combination of regular expressions and hstore provide endless possibilities for arbitrary data capture.
The optional user
and number
named groups are special. The user
group is
used for attribution of the data point to a particular Slack user (defaults to
the slash command sender). The number
group is used to quantify the data point
and is stored as a decimal number (defaults to 1.0).
$ git clone git@github.com:collectiveidea/metrics.git
$ cd metrics
$ rvm 2.2.3@metrics --create --ruby-version
$ bin/setup
$ rspec