Module: OpenTelemetry::Instrumentation::Trilogy::Patches::Client
- Defined in:
- lib/opentelemetry/instrumentation/trilogy/patches/client.rb
Overview
Module to prepend to Trilogy for instrumentation
Instance Method Summary collapse
Instance Method Details
#initialize(options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/opentelemetry/instrumentation/trilogy/patches/client.rb', line 16 def initialize( = {}) @connection_options = # This is normally done by Trilogy#initialize tracer.in_span( 'connect', attributes: client_attributes.merge!(OpenTelemetry::Instrumentation::Trilogy.attributes), kind: :client ) do super end end |
#ping ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/opentelemetry/instrumentation/trilogy/patches/client.rb', line 28 def ping(...) tracer.in_span( 'ping', attributes: client_attributes.merge!(OpenTelemetry::Instrumentation::Trilogy.attributes), kind: :client ) do super end end |
#query(sql) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/opentelemetry/instrumentation/trilogy/patches/client.rb', line 38 def query(sql) tracer.in_span( OpenTelemetry::Helpers::MySQL.database_span_name( sql, OpenTelemetry::Instrumentation::Trilogy.attributes[ OpenTelemetry::SemanticConventions::Trace::DB_OPERATION ], database_name, config ), attributes: client_attributes(sql).merge!( OpenTelemetry::Instrumentation::Trilogy.attributes ), kind: :client ) do |_span, context| if propagator && sql.frozen? sql = +sql propagator.inject(sql, context: context) sql.freeze elsif propagator propagator.inject(sql, context: context) end super end end |