extension to instrument SQL statements - execute_insert is seemingly not called? #2250
Replies: 6 comments 5 replies
-
PostgreSQL uses INSERT RETURNING, so you want to override |
Beta Was this translation helpful? Give feedback.
-
I see the method in the source code, but when I override it, it's not called (the Here is more context around how I'm setting it up (still somewhat simplified and shown as inline, but this is the basic order of operations): Sequel::Database.extension :pg_array
Sequel::Database.extension :my_instrumentation
sequel_db = Sequel.connect(ENV["DATABASE_URL"])
sequel_db.logger = SemanticLogger["Sequel::Database"]
Sequel::Model.db = sequel_db
model = SomeModel.new
model.update(some_attributes) # this triggers the INSERT |
Beta Was this translation helpful? Give feedback.
-
Have you considered hooking onto |
Beta Was this translation helpful? Give feedback.
-
Is there some Sequel setting that "turns off" this logging feature such that the method would no longer be called? |
Beta Was this translation helpful? Give feedback.
-
Another hook could be |
Beta Was this translation helpful? Give feedback.
-
Cool |
Beta Was this translation helpful? Give feedback.
-
Trying to add some basic instrumentation in my app and I could not find solid docs on what an extension is/can do, so I'm referencing https://github.com/signalfx/ruby-sequel-instrumentation/. Here is a simplified version:
It is registered like so:
a
SELECT
causes "execute" to be printed andUPDATE
causes "execute_dui" to be printed.INSERT
, however does not trigger anything. The insert does happen, however the methods in my extension aren't called.This leads me to believe I'm doing something wrong and any expected behavior is incidental.
Anyone know what I'm missing or what I need to do differently?
Sequel 5.86.0
Postgres server 16.1 (Debian 16.1-1.pgdg120+1))
Ruby 3.3.5
Beta Was this translation helpful? Give feedback.
All reactions