Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging exceptions that happen during a command/query #3884

Closed
wants to merge 1 commit into from

Conversation

niedfelj
Copy link
Contributor

We spent weeks trying to track down networking issues between Heroku and Mongolab because we were not seeing answers from commands like:

MOPED: 127.0.0.1:27017 COMMAND database=admin command={:ismaster=>1} runtime: 3.2830ms

They just kept bouncing between nodes asking "ismaster". The main underlying cause was connection pool saturation, which was compounded by the fact that every uncaught exception (Timeout::Error) ends in the Failure class trying to Disconnect (which in turn tries to check out another connection to disconnect that isn't even the offending connection and of course doesn't make a lot of sense with pool saturation, Moped PR coming for that).

I've added a few lines to the log_subscriber so that if the payload has an exception, it shows it along with the command or query etc that it was TRYING to run, instead of making it look like it completed successfully. In most cases, Mongoid/Moped will still handle the exception/retry if it needs to, but surfacing these exceptions is extremely useful for optimizing our cluster and figuring out when and where we are having any sort of issue (connectivity, node failure)

@niedfelj
Copy link
Contributor Author

Moped PR submitted related to this mongoid/moped#338

@estolfo
Copy link
Contributor

estolfo commented Jan 6, 2016

This is no longer relevant because Mongoid uses the MongoDB Inc Ruby driver instead of Moped and logging of ismaster is done there.

@estolfo estolfo closed this Jan 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants