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
Tracking query times #232
Comments
Hey @scottrobertson, we instrument our queries for Appsignal (which is great btw) I've adapted what we use and that should work for you: require "nobrainer"
if defined?(ScoutApp) # Adapt to match your module
class RethinkdDBInstrumentation < NoBrainer::QueryRunner::Middleware
def call(env)
ScoutApp.instrument("RethinkDB", RethinkDB::RPP.pp(env[:query])) do
@runner.call(env)
end
end
end
NoBrainer::QueryRunner.stack.insert_after(
NoBrainer::QueryRunner::Profiler,
RethinkdDBInstrumentation
)
end PS. We've been using this, but we're still figuring out how to filter parameters from this (so it wouldn't send data to the monitoring party), do you know if there's any easy way to do that? Preferably without regex magic? |
@jeroenvisser101 awesome, that is perfect. Thank you! I wasnt aware of |
Not yet sadly. The only way I can find is regex at the moment :( |
Ah, too bad, thanks anyways :) |
You can get instrumentation by doing: class YourProfiler
def on_query(env)
# env is a hash with a bunch of info.
# see https://github.com/nviennot/nobrainer/blob/master/lib/no_brainer/profiler/logger.rb for example usage
end
NoBrainer::Profiler.register(self.new)
end I'm not sure how to filter out params from the query in a systematic manner :/ |
Nice! Thank you |
@nviennot that one is even better, thanks, will adapt ours too :) |
Hey. We use scoutapp.com for monitoring.
We currently track our non NoBrainer queries, but we need a way to track the queries performed by NoBrainer. What we do for manual queries is wrap it in the following:
Can you think of a way to do this globally for all NoBrainer queries? Wrapping each call is not possible (it would be incredibly messy)
The text was updated successfully, but these errors were encountered: