appsignal-ruby
appsignal-ruby copied to clipboard
ROM (Ruby Object Mapper) support
Hi, any plans to support it? More and more popular every day, and new hanami will use it too.
rom-sql use sequel below, maybe it will help? But Sequel setup do not work (manual either)
This works for me:
notifications.subscribe(:sql) do |time:, name:, query:|
Appsignal.instrument_sql("sql.#{name}.rom", nil, query)
end
can I somehow add extra tag to it. I want to report query execution time somehow (so overwrite Duration)
Discussed in https://app.intercom.io/a/apps/yzor8gyw/inbox/inbox/conversation/24771981790
working quite well dry-web (roda + rom) example:
Your::Container.boot :appsignal do |container|
init do
require "appsignal"
require 'appsignal/integrations/object'
use :persistence # rom setup and load
end
start do
Appsignal.config = Appsignal::Config.new(
container.root,
container[:settings].appsignal_app_env,
name: 'logbrowser'
)
Appsignal.start
Appsignal.start_logger
notifications.subscribe(:sql) do |time:, name:, query:|
relation = query.match(/\"(\w*?)\"/)
if relation
log_path = "sql.#{name}.#{relation[1]}.rom"
else
log_path = "sql.#{name}.rom"
end
time = time*(10**6)
Appsignal::Transaction.current.record_event(log_path, nil, query, time, Appsignal::EventFormatter::SQL_BODY_FORMAT)
end
end
end