Issue: Adding marginalia to systems which use AR plugins to manage replication and sharding results in no comments being appended to queries.
Context: AR replication libraries like [Octopus|https://github.com/tchandy/octopus] and [DBCharmer|https://github.com/kovyrin/db-charmer] give you Proxy objects back when you call ActiveRecord::Base.connection.is_a? - these Proxy objects then delegate to the correct Adapter.
Solution: I initially tried to avoid patching your gem, instead I looked to see whether these libraries were "doing it wrong". I think they're actually doing the right thing - this lead me to decide that giving users the ability to override the decision making is the right thing to do. That is "we're smart enough to know to use a non trivial piece of code like Octopus, we want to be smart enough to tell other pieces of software to do the right thing in these cases".
support for forcing marginalia inclusion
The current code does seem to work ok with slave_pools at least...
@inspire22, any chance you could provide more details? I'm happy to look into making this better.
I haven't looked into your patch specifically, was just chiming in that I use the slave_pools gem and marginalia seems to work OK with it. It's not quite as complex as octopus/dbcharmer though. But my comments are added to my queries as expected.
Would pull #42 fix the issue?
yes, #42 should solve this...