Module: NetworkResiliency::Adapter::Mysql::Instrumentation
- Defined in:
- lib/network_resiliency/adapter/mysql.rb
Instance Method Summary collapse
Instance Method Details
#connect(_, _, host, *args) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/network_resiliency/adapter/mysql.rb', line 20 def connect(_, _, host, *args) # timeout = query_options[:connect_timeout] return super unless NetworkResiliency.enabled?(:mysql) begin ts = -NetworkResiliency. super rescue Mysql2::Error::TimeoutError => e # capture error raise ensure ts += NetworkResiliency. NetworkResiliency.record( adapter: "mysql", action: "connect", destination: host, error: e&.class, duration: ts, ) end end |