Comments (11)
Hi Kevin,
Sorry for taking so long to get back to you. We really try to be more responsive than this.
I'll have the engineer in charge of the gem take a look at this and get back to you.
Best,
Starr
from honeybadger-ruby.
Hi. It's been another 2 weeks. Any update?
from honeybadger-ruby.
I'm sorry Kevin. I was moving over the past few weeks, so I'm a bit behind. Finally getting caught up. :)
You make an excellent point here. #34 looks good, but I'm wondering if we should change references to Honeybadger.context.clear!
to simply Honeybadger.clear!
. In the future, there is potential for #clear!
to do more than clear just context. For example, we could take the same approach for tracking request data so that it's always available when calling Honeybadger.notify
(someone had suggested that recently). What do you think?
from honeybadger-ruby.
No worries. I just was poking around in other issues and figured I'd prod :-)
I don't mind if you want to have two different methods. As written now, they're the same so I was just suggesting the simplification to cut out the intermediary work. If #34 is merged, the overhead here is reduced, but you're still potentially initializing a hash and dealing with thread local writes.
Having something like Honeybadger.clear_context!
would allow you to just nil out the thread local. But granted you lose the chaining. I guess the way around that would be to revisit the "getter" doing initialization at all.
from honeybadger-ruby.
I'm going to go ahead and merge #34. We can actually take it one step further and not even initialize Thread.current[:honeybadger_context] if there is no hash passed to #context
. I'll try making that change.
I think version 2.0 of the gem will take the same approach to set rack parameters and env, in which case it may be nice to create a separate object to wrap the thread storage. I'm still debating about keeping chaining intact - it's nice to have, but not sure the current implementation quite fits.
from honeybadger-ruby.
Not initializing the thread local sounds great. I didn’t go that far because I wasn’t sure if there were places where a non-nil object was expected and I wasn’t able to get the test suite running. But if that can be an avoided, that’d be fantastic. While these seem like small optimizations, they add up in long-running processes since that middleware is called on every single request to an app.
From: joshuap
Sent: Wednesday, July 10, 2013 11:11 PM
To: honeybadger-io/honeybadger-ruby
Cc: Kevin Menard
I'm going to go ahead and merge #34. We can actually take it one step further and not even initialize Thread.current[:honeybadger_context] if there is no hash passed to #context. I'll try making that change.
I think version 2.0 of the gem will take the same approach to set rack parameters and env, in which case it may be nice to create a separate object to wrap the thread storage. I'm still debating about keeping chaining intact - it's nice to have, but not sure the current implementation quite fits.
—
Reply to this email directly or view it on GitHub.
from honeybadger-ruby.
Agreed! I added the change on #34, check it out if you want. I'll close this one, but may revisit later for v2.
from honeybadger-ruby.
Sorry, I'm confused on the resolution status here. Proposed API changes aside, you're still potentially creating a hash that you're storing in the thread local just to nil it out immediately after. If already storing context this isn't an issue, but if not, it's creating similar unnecessary object churn like #34. That was ultimately what I wanted to see addressed, not the API.
from honeybadger-ruby.
See my commit here: 6346c28
from honeybadger-ruby.
That's indeed the part I missed. Thanks a lot for taking care of this.
from honeybadger-ruby.
np, thanks for bringing it to my attention! :)
from honeybadger-ruby.
Related Issues (20)
- Add support for Hanami HOT 1
- `Honeybadger.notify` requires `error_message` to be specified when using a Hash HOT 4
- Documentation and source mismatch with Rails.error.record HOT 1
- `Honeybadger::Config#respond_to?` Always Returns true
- Help suppressing a certain error HOT 4
- Honeybadger CLI errors when the deploy command is called with any option HOT 3
- Minitest: Test Backend Notices Not Added to `Honeybadger::Backend::Test` HOT 9
- Invalid class_name param in documentation HOT 1
- Use nested context from objects where available
- Sidekiq 7.1.5 and later changes number of arguments for error handlers
- Add check-in configuration sync HOT 2
- Automate releases with Github Actions
- Flaky test in JRuby test matrix entry
- Allow check-ins to be made by slug as well as id. HOT 8
- Avoid bundling unnecessary dependencies in published gem HOT 3
- Exceptions raised in jobs from Solid Queue are not automatically reported HOT 10
- Sanitizer#filter_key? returns a warning for Numeric hash keys HOT 5
- ActiveJob premature reporting HOT 2
- ActiveJob rescued exceptions should not be reported HOT 2
- Honeybadger.context returns Honeybadger::Agent when passing a block
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from honeybadger-ruby.