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



26
27
28
29
30
31
32
33
34
# File 'lib/opentelemetry/instrumentation/mysql2/patches/client.rb', line 26

def prepare(sql)
  tracer.in_span(
    _otel_span_name(sql),
    attributes: _otel_span_attributes(sql),
    kind: :client
  ) do
    super(sql)
  end
end

#query(sql, options = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/opentelemetry/instrumentation/mysql2/patches/client.rb', line 16

def query(sql, options = {})
  tracer.in_span(
    _otel_span_name(sql),
    attributes: _otel_span_attributes(sql),
    kind: :client
  ) do
    super(sql, options)
  end
end