CartoDB/cartodb — pull request #1352 by zenitraM (2014-12-03 16:58:55+00:00)
Title: Add Resque timings and metrics

This PR adds the [resque-metrics](https://github.com/quirkey/resque-metrics/) gem to get several hooks on Resque job queueing/forking.

Then, it outputs a separate log, in the location ``log/resque_metrics.log`` with the following contents:

```
{"event":"job_enqueue","job_class":"Resque::ImporterJobs","queue":"imports","time":51}
{"event":"job_fork","job_class":"Resque::ImporterJobs","queue":"imports"}
{"event":"job_enqueue","job_class":"Resque::UserJobs::Mail::DataImportFinished","queue":"users","time":496}
{"event":"job_complete","job_class":"Resque::ImporterJobs","queue":"imports","time":45373}
{"event":"job_fork","job_class":"Resque::ImporterJobs","queue":"imports"}
{"event":"job_enqueue","job_class":"Resque::UserJobs::Mail::DataImportFinished","queue":"users","time":496}
{"event":"job_complete","job_class":"Resque::ImporterJobs","queue":"imports","time":23599}
{"event":"job_fork","job_class":"Resque::ImporterJobs","queue":"imports"}
{"event":"job_complete","job_class":"Resque::ImporterJobs","queue":"imports","time":19590}
{"event":"job_fork","job_class":"Resque::UserJobs::Mail::DataImportFinished","queue":"users"}
{"event":"job_enqueue","job_class":"Resque::ImporterJobs","queue":"imports","time":51}
{"event":"job_fork","job_class":"Resque::ImporterJobs","queue":"imports"}
{"event":"job_complete","job_class":"Resque::ImporterJobs","queue":"imports","time":52686}
{"event":"job_enqueue","job_class":"Resque::GeocoderJobs","queue":"geocodings","time":51}
{"event":"job_fork","job_class":"Resque::GeocoderJobs","queue":"geocodings"}
{"event":"job_complete","job_class":"Resque::GeocoderJobs","queue":"geocodings","time":8063}
```

It also stores several metrics on Redis under the ``resque:_metrics_`` namespace.

The obligatory contribution to the Gem Fund :tm: shall be done by @javisantana