Calls from the rails console never seem to get sent, but calls in the app servers work #52

barmstrong opened this Issue Feb 20, 2013 · 7 comments


None yet
3 participants

Title pretty much describes it. If I call Librato.increment from the production rails console, no data gets sent. Not sure if this intended or not, but might be worth mentioning as it is a gotcha during first run testing. And it implies the data would not get sent from rake tasks either?

Is there a way to enable it in the console/rake tasks? Or maybe this is a job for the gem? Thanks.


nextmat commented Feb 20, 2013

Ah yes, this is intended behavior. The reporting thread intentionally isn't started when you start up in console or test mode, I should probably make that more clear in the docs.

As for use in rake tasks and worker processes, right now using librato-metrics for more manual submission is probably the best option although we intend to provide more drop-in support for that kind of thing in librato-rails in the future.

nextmat closed this Feb 20, 2013

Ok interesting. Yeah would make sense to add to the docs. And also probably to be able to set an environment variable or something to turn it on in consoles/rake tasks. Thanks!


nextmat commented Feb 24, 2013

Been thinking a little more about this. What's the use case you see for submission in a console session?

Basically just to backfill old data. If we want to pre-populate data for a
metric, or change how something is measured and need to wipe it out/start
over, it's useful to backfill. We often run this as a one off in the
console or in a rake task. The librato-metrics gem seems ideal for this,
so I like that solution.

Also, it was sort of a gotcha for me when first getting it set up, I tried
a couple increments in the console and didn't see anything show up on the
other side. Makes perfect sense in hindsight after I saw how you guys were
aggregating it and the background thread and everything. So maybe just a
note in the README about performance and how it works or something like
that. Anyway, thanks for the awesome gem.

Btw, would also be cool to instrument background workers (we use Resque for this). Seeing how many of a certain job have been run, how long they are taking etc.

Yeah, it could be nice to use this gem in Resque. And it could be nice to use in the console, maybe also just to debug.


nextmat commented Mar 22, 2013

We do intend to add better resque support, monitor #8 for that - it will be a focus after we finish refactoring some of the internals. Just opened #59 for docs on manually submitting on console mode.

I believe you can currently call Librato::Rails.flush to manually submit the queued metrics, but this part of the interface is not stable and will be changing shortly so I would beware coding it into your worker processes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment