Module: OpenTelemetry::Instrumentation::Mysql2::Patches::Client
- Defined in:
- lib/opentelemetry/instrumentation/mysql2/patches/client.rb
Overview
Module to prepend to Mysql2::Client for instrumentation
Instance Method Summary collapse
Instance Method Details
#prepare(sql) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/opentelemetry/instrumentation/mysql2/patches/client.rb', line 34 def prepare(sql) tracer.in_span( _otel_span_name(sql), attributes: _otel_span_attributes(sql), 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(sql) end end |
#query(sql, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/opentelemetry/instrumentation/mysql2/patches/client.rb', line 16 def query(sql, = {}) tracer.in_span( _otel_span_name(sql), attributes: _otel_span_attributes(sql), 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(sql, ) end end |