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
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/opentelemetry/instrumentation/trilogy/patches/client.rb', line 13 def initialize( = {}) = # 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
25 26 27 28 29 30 31 32 33 |
# File 'lib/opentelemetry/instrumentation/trilogy/patches/client.rb', line 25 def ping(...) tracer.in_span( 'ping', attributes: client_attributes.merge!(OpenTelemetry::Instrumentation::Trilogy.attributes), kind: :client ) do super end end |
#query(sql) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/opentelemetry/instrumentation/trilogy/patches/client.rb', line 35 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| propagator.inject(sql, context: context) super(sql) end end |