Webinar: Continuous Code Improvement Series | How to Improve with AI-Assisted Workflows Register Here Today!
June 5th, 2014 • By Brian Rue
"This stack trace would be so much easier to debug if I knew what the value of that variable was" - said us, many many times. We finally scratched our own itch and built this into Rollbar.
It's really awesome. Take for example a bug I ran into with our new deploy emails feature:
"Hmmm, sure would be nice if I knew which variable was
the past, I would've had to reproduce locally, or add an additional
log each variable in production. But now I can just press "locals" for the stack frame and see it
prev_deploy." That was all I needed:
prev_deploy will be
deploy is the
very first deploy in this project. Easy two-line fix. Time taken from opening the Rollbar
notification to committing the fix: 2 minutes. Rollbarred!
We've implemented this in Python (pyrollbar), and are actively exploring other languages. Ruby and PHP are looking promising. Here's how it works in Python.
When this feature is enabled and an exception is reported, we use the inspect module to collect:
There are two main edge cases to deal with:
scrub_fieldsconfiguration used for scrubbing request data. If the variable name matches one of the field names to be scrubbed, the variable's value will be scrubbed. (Like
access_tokenin the screenshot above.)
If you're using Python, simply update to pyrollbar 0.8.0 or greater. Local variables are on by default; see the docs for the full config reference.
If you're using Erlang, you're in luck - erollbar already sends argument values. Check its docs for details.
Want this in a different language? Let us know -- email firstname.lastname@example.org or open an issue on the GitHub repo for the appropriate Rollbar library.
Don't use Rollbar yet? Sign up for a free account, follow the setup instructions, and you'll be debugging production in power mode in no time.